yep fixed that and still get the error, this is inreasingly frustrating.
I fixed it to this
// Create a SQL command object.
SqlCommand command = new SqlCommand(
String.Format("UPDATE PersonalDetails set FIRSTNAME = '{1}', SURNAME = '{2}' WHERE ID = '{0}'",
FIRSTNAME, SURNAME, ID), connection);
still get the same error.
mahedee
You can also use cmd.ExecuteNonQuery(); for insert also.
sorry but what do you mean by this, really confused?
Do I remove any of these lines: ?
// Execute the SQL command and store the returned integer.
int response = (int)command.ExecuteScalar();
// Close the connection PS: I KNOW I DONT REMOVE THIS LINE
connection.Close();
// Return the result.
return (response > 0);
tiiimmmy
Member
8 Points
29 Posts
Re: Update function in web form using SQL express
Apr 26, 2012 07:52 AM|LINK
yep fixed that and still get the error, this is inreasingly frustrating.
I fixed it to this
// Create a SQL command object. SqlCommand command = new SqlCommand( String.Format("UPDATE PersonalDetails set FIRSTNAME = '{1}', SURNAME = '{2}' WHERE ID = '{0}'", FIRSTNAME, SURNAME, ID), connection);still get the same error.
sorry but what do you mean by this, really confused?
Do I remove any of these lines: ?
// Execute the SQL command and store the returned integer. int response = (int)command.ExecuteScalar(); // Close the connection PS: I KNOW I DONT REMOVE THIS LINE connection.Close(); // Return the result. return (response > 0);