title: Doing an SQL Update with an Inner Join
body: <p>I am trying to update a field in the user table using an inner join with another table, but it does not seem to be working. I am using the code below:</p>
  
  <pre><code>        SqlCommand cmd = new SqlCommand("UPDATE U SET User.firstname = @Firstname FROM dbo.User AS U INNER JOIN dbo.Driver AS D ON U.userid = D.driverid WHERE D.driverid = @Driverid");
          cmd.CommandType = CommandType.Text;
          cmd.Connection = conn;
          cmd.Parameters.Add("@Firstname", SqlDbType.VarChar, 50).Value = firstname;
          cmd.Parameters.Add("@Driverid", SqlDbType.VarChar, 50).Value = driverid;
          conn.Open();
          cmd.ExecuteNonQuery();
  </code></pre>
  
  <p>SQL:</p>
  
  <pre><code>UPDATE
    U 
  SET 
    User.firstname = @Firstname 
  FROM 
    dbo.User AS U 
    INNER JOIN dbo.Driver AS D ON 
      U.userid = D.driverid 
  WHERE
    D.driverid = @Driverid
  </code></pre>
  
  <p>I am getting the following error:</p>
  
  <p>System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.Data.SqlClient.SqlException: Incorrect syntax near the keyword 'User'</p>
  
  <p>Where could I be going wrong? Thanks</p>