Khi xây dựng Web Method update trong web service thì mình gặp lỗi này (khi test webservice)
Mã:
System.Data.SqlClient.SqlException: Incorrect syntax near ')'.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
at WebService.UpdateUserInfo(Int32 userid, String pass, String company, String email, String phone, String address, String country, String city) in f:\Bai tap FPT\WebService\DefectTrackingSystem\App_Code\WebService.cs:line 81
Đây là code của mình
Mã:
[WebMethod(Description = "Update information for user")]
public Boolean UpdateUserInfo(int userid, string pass, string company, string email,
string phone, string address, string country, string city)
{
if (con.State == ConnectionState.Closed) con.Open();
cmd = new SqlCommand("update Users set Password = @Password, Company = @Company, Email = @Email, Phone = @Phone, Address = @Address, Country = @Country, City = @City where UserId = @UserID)", con);
cmd.Parameters.AddWithValue("UserID", userid);
cmd.Parameters.AddWithValue("Password", pass);
cmd.Parameters.AddWithValue("Company", company);
cmd.Parameters.AddWithValue("Email", email);
cmd.Parameters.AddWithValue("Phone", phone);
cmd.Parameters.AddWithValue("Address", address);
cmd.Parameters.AddWithValue("Country", country);
cmd.Parameters.AddWithValue("City", city);
int i = cmd.ExecuteNonQuery();
if (i > 0)
return true;
else
return false;
}
Ai có thể giúp mình tìm xem chỗ nào gây ra lỗi không ?
Thanks.
View more random threads:
Bất chấp những lầm tưởng phổ quát, hồ hết những người có âm đạo đều khó lên đỉnh khi bị kích thích âm đạo. Tuy nhiên, điều đó không có tức thị nó không thể vui được! Việc xâm nhập vào âm đạo bằng...
Quý bà giải tỏa bằng việc kích...