2013-04-21 73 views
0

C#錯誤解析查詢令牌1號線C#錯誤解析查詢令牌1號線

 cmmd.CommandText = "Select total from Dept_Sales where department ='" + department + "'"; 
    var dtotal = cmmd.ExecuteScalar().ToString(); 
    var nntotal = dtotal + price; 

    SqlCeCommand cmmmmd = new SqlCeCommand("update [Dept_Sales] SET [total][email protected]) where [department][email protected]", conn); 
    { 
    cmmmmd.Parameters.AddWithValue("@val1", nntotal); 
    cmmmmd.Parameters.AddWithValue("@val2", department); 
    cmmmmd.CommandType = System.Data.CommandType.Text; 
    cmmmmd.ExecuteNonQuery()   } 
    } 
    catch (Exception ex) 
    { 
    MessageBox.Show(ex.Message); 
    } 
    also dtotal =3.51 
    and price = 3.51 
    nntotal = 7.02 

我認爲有可能是我的查詢問題的探析我已經改變了它15次同樣的錯誤誰能給我任何建議

回答

0

從行#4刪除exteng )可能有所幫助。因此,它應該是這樣的:

SqlCeCommand cmmmmd = 
    new SqlCeCommand("update [Dept_Sales] SET [total][email protected] 
         where [department][email protected]", conn); 
相關問題