I’m wanting to set the current time i my database
My column is a “datetime” format
My insert SQL is as follows.
// Set last login
DateTime date = DateTime.Now;
string insertSQLDet = "INSERT INTO [dbo].[user] (last_login) VALUES (" + date + ") WHERE user_id=" + user_id;
But I get an error saying I have incorrect near “WHERE”. Can anyone see what’s wrong?
My guess! you want to update the
last_loginfield so use theUPDATEstatement and always use parameters.