SQLTeam.com | Weblogs | Forums

Identifier Expected


#1

I am getting an error on the string updateCmd line. Can someone help me fix this?

conn.Open();
// SQL Update Command
string updateCmd = "UPDATE tblDimContactLog SET ContactLogDate = @ContactLogDate," + "ContactLogMethod = @ContactLogMethod," + "ContactLogNote = @ContactLogNote" Where ContactLogID = @ContactLogID;
SqlCommand mySqlUpdate = new SqlCommand(updateCmd, conn);
mySqlUpdate.Connection = conn;
mySqlUpdate.CommandType = CommandType.Text;


#2

This is a C# question, not a SQL question,

However, this is not the way to pass parameters to an update statement. See SqlParameter Class

but the problem is here[quote="arthur_patrick, post:1, topic:5441"]
"ContactLogNote = @ContactLogNote" Where ContactLogID = @ContactLogID;
[/quote]

The Where clause is not a quoted string