Im trying to insert an SQLDateTime into an SQL database column which takes DateTime
here is an extract of my code
sTime = new SqlDateTime(DateTime.Now); command.CommandText = "INSERT INTO Sensors VALUES ('" + sensors[i].getName() + "','" + sensors[i].getType() + "'," + sensors[i].getVal() + ", " + sTime.Value + " )"; command.ExecuteNonQuery();
The error I'm getting is "Incorrect syntax near '10'. "
10 is the hour it is at this moment it seems to process the date ok but gets stuck after the hour the format of sTime after
sTime = new SqlDateTime(DateTime.Now);
Im really stumped by this and databases arn't my strong point, after this line of code is solved thats the end of my final year project in college. So help would be greatly appreciated.