2013-09-26 61 views
0

我有做更新到数据库表 但是当我调用它,我有一个异常的方法“附近有语法错误('。”什么是错误在这个SQL更新stament

这里是方法

internal Boolean update(int customerID,int followingID, string fullName, string idNumber, string address, string tel, string mobile1, string mobile2, string email, string customerComment, DateTime timeStamp) 
    { 
     string sqlStatment = "update customers set (followingID, fullName,idNumber,address,tel,mobile1,mobile2,email,customerComment,timeStamp) = (@followingID, @fullName,@idNumber,@address,@tel,@mobile1,@mobile2,@email,@customerComment,@timeStamp) where [email protected]"; 

     SqlConnection con = new SqlConnection(); 
     con.ConnectionString = connection; 
     SqlCommand cmd = new SqlCommand(sqlStatment, con); 

     cmd.Parameters.AddWithValue("@customerID", customerID); 
     cmd.Parameters.AddWithValue("@followingID", followingID); 
     cmd.Parameters.AddWithValue("@fullName", fullName); 
     cmd.Parameters.AddWithValue("@idNumber", idNumber); 
     cmd.Parameters.AddWithValue("@address", address); 
     cmd.Parameters.AddWithValue("@tel", tel); 
     cmd.Parameters.AddWithValue("@mobile1", mobile1); 
     cmd.Parameters.AddWithValue("@mobile2", mobile2); 
     cmd.Parameters.AddWithValue("@email", email); 
     cmd.Parameters.AddWithValue("@customerComment", customerComment); 
     cmd.Parameters.AddWithValue("@timeStamp", timeStamp); 


     bool success = false; 
     try 
     { 

      con.Open(); 
      cmd.ExecuteNonQuery(); 
      success = true; 

     } 
     catch (Exception ex) 
     { 

      success = false; 
      //throw ex; 
     } 
     finally 
     { 
      con.Close(); 
     } 
     return success; 
    } 

,这里是数据库表列

Customers table

+1

UPDATE SQL查询语法错... –

回答

1

从来没有见过这样的update语句 - 通常这会是set followingid = @followingid, fullname = @fullname等,等