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

No members online now.

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,708
Latest member
SherleneF1

Latest Threads

Top