Hello,
At the moment i'm using a MS SQL Server 2005 but i'm developing the program with the OleDB access layer so that it will also work with other databases like MySQL. The problem i'm having is when i try to update a row in a table and have a parameter with the SQL function to get the current datetime. Eg the value ="getdate()", then when i execute the command it gives the following error: OleDbException -> Conversion failed when converting character string to smalldatetime data type.
To illustrate it all here is a code example:
OleDbCommand command = new OleDbCommand("UPDATE commissie SET date= ",connection);
OleDbParameter parameter = new OleDbParameter("date","getdate()");
parameter.SourceColumn = "date";
parameter.DbType = DbType.String;
int count = command.ExecuteNonQuery();
When i change the DbType to datetime i get the following error: FormatException -> Failed to convert parameter value from a String to a DateTime.
So how can get it to work
Thanks a lot,
ChoKamir
.NET Development5
|