Click to See Complete Forum and Search --> : read datetime from SQL Server


yosef
November 23rd, 2006, 02:48 AM
Hello everybody

How to read/write 'datetime' type from SQL Server to C#


Thanks

Shuja Ali
November 23rd, 2006, 03:02 AM
You can use this query to get the Date & time from the SQL Server Select GetDate()

Are you talking about retrieving Datetime from a Field or do you want to retrieve the server's data & time?

yosef
November 23rd, 2006, 03:12 AM
Hello Shuja Ali


SQL script has this code (for example) :


create table XXX
(
mydate datetime,
)


I need to read field 'mydate' to C# object DateTime and then
write new date to the table (from DateTime object)


Thanks

Shuja Ali
November 23rd, 2006, 04:25 AM
This is a basic ADO.NET question. You will have to learn how ADO.NET works and what will you need to do to access a database using ADO.NET.

Go though this
http://samples.gotdotnet.com/quickstart/howto/doc/adoplus/ADOPlusOverview.aspx