0

Quick question. I have an updatestring to send into an SQL command. It actually needs to update three columns in one row.
I know how to write the string to update one column but is there a way to write this string to update 3 colums in that one row? Here's my string that updates one row. How can I make this update, startDate, endDate and title using this string?

public string UpdateStartString()
{
string updateStartString = @"
update Appointments
set startDate = @startDate
where appointment_id = @Record";
 
return updateStartString;
}
2
Contributors
1
Reply
2
Views
11 Years
Discussion Span
Last Post by Narue
0

The SET clause can be a comma separated list of assignment expressions:

string command =
  @"update  Appointments " +
   "set     [startDate] = @Start" +
   "        , [endDate] = @End" +
   "        , [title] = @Title " +
   "where  ([appointment_id] = @Record)";
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.