views:

8

answers:

0

the project I'm working on uses the OleDb provider classes to connect to various databases. I have no choice in the matter. I have to update it so that it works with the new "time" column type in SQL 2008. My connection string is using "Provider=SQLNCLI10;"... and this seems to know about all the types except "time". Whereas the SqlClient data adapter creates a dataset with DataColumn of type "System.TimeSpan", the OleDb data adapater creates a datacolumn for the "time" field as a "System.Object" type and fills it with a string. this works fine when reading... but when I try to do an update/insert, I'm getting errors.

If I put a string into the System.Object column, I get this: "Implicit conversion from data type sql_variant to time is not allowed. Use the CONVERT function to run this query."

if I put a timespan in there, it gives a different error.

So what I'm asking is: how do I use OleDbDataAdapter to insert/update a record against a Sql 2008 table with a "time" column in it?

-Thank you

related questions