Hey Guys,
I'm connecting to an SQL server and updating some fields. This works:
cmd = new SqlCommand("UPDATE Laptops SET Checkout_Date = '" + form_CheckOut.checkout + "' WHERE name='pen-laptop1'", conn);
cmd.ExecuteNonQuery();
But this one doesn't:
cmd = new SqlCommand("UPDATE Laptops SET " +
" isCheckedOut = 0" +
" Checkout_Date = '" + form_CheckOut.checkout +
"', Checkin_Date = '" + form_CheckOut.checkin +
"', Checked_Out_By = '" + form_CheckOut.user +
"', WHERE name = 'pen-laptop1'");
cmd.ExecuteNonQuery();
EDIT - FIXED CODE BELOW
cmd = new SqlCommand("UPDATE Laptops SET isCheckedOut = 0" +
", Checkout_Date = '" + form_CheckOut.checkout +
"', Checkin_Date = '" + form_CheckOut.checkin +
"', Checked_Out_By = '" + form_CheckOut.user +
"' WHERE Name = '" + name + "'", conn);