PC Review


Reply
Thread Tools Rate Thread

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

 
 
Steve Kershaw
Guest
Posts: n/a
 
      26th Aug 2006
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

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Correctly format a string for comparison against a datetime column in MS SQL Server rhaazy Microsoft C# .NET 2 3rd Aug 2007 09:40 PM
Millisecond values missing when inserting datetime into datetime column of sql Server Manikandan Microsoft C# .NET 4 18th Jul 2007 08:59 PM
How can I save a DateTime from my C# program into a SQL Server (datetime) database column. Steve Kershaw Microsoft ASP .NET 5 29th Aug 2006 03:10 AM
Inserting C# datetime milliseconds into sql Server DateTime tk042383 Microsoft ADO .NET 2 4th May 2004 04:28 PM
Query on Time part of SQL Server DateTime column Nick Carter Microsoft ADO .NET 0 17th Jul 2003 09:30 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:57 PM.