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;
}

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)";
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.