How do you save a (C#) DateTime into a SQL Server datetime column?

S

Steve Kershaw

Hi,

I have a table in a SQL Server 2005 database that has a column of type
"datetime". From a C# program I need to insert todays date into this
column like so:

gridAdapter.InsertNewGridID( Convert.ToDateTime(DateTime.Today) );

I keep on getting an error: "Implicit conversion from data type
sql_variant to int is not allowed. Use the CONVERT function to run this
query."

How is this done?

Thanks in advance.
Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top