Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Date/Time stamp in SQL

Reply
Thread Tools

Date/Time stamp in SQL

 
 
=?Utf-8?B?QmVydA==?=
Guest
Posts: n/a
 
      01-30-2004
I would like to store a Date/Time stamp in a SQL tabel
Now only the Date is stred and not the time. How to I get the time also

This is the code (There is more, but that works)

atSQLexe ex=new atSQLexe()
ex.addConnection=app.dbConnection
sql="INSERT INTO Log (UserID, Date) VALUES (@UserID, @Date)"
ex.addParm("@UserID",userID)
ex.addParm("@Date", DateTime.Today)
tr

ex.ExecuteSQL(sql)
}
 
Reply With Quote
 
 
 
 
Kim Larsen
Guest
Posts: n/a
 
      01-30-2004
Try using

DateTime.Now insted of DateTime.Today

/Kim


"Bert" <> skrev i en meddelelse
news:B3465988-5B68-4F55-82BB-...
> I would like to store a Date/Time stamp in a SQL tabel.
> Now only the Date is stred and not the time. How to I get the time also?
>
> This is the code (There is more, but that works):
>
> atSQLexe ex=new atSQLexe();
> ex.addConnection=app.dbConnection;
> sql="INSERT INTO Log (UserID, Date) VALUES (@UserID, @Date)";
> ex.addParm("@UserID",userID);
> ex.addParm("@Date", DateTime.Today);
> try
> {
> ex.ExecuteSQL(sql);
> }



 
Reply With Quote
 
 
 
 
Wardeaux
Guest
Posts: n/a
 
      01-30-2004
Bert,
if you have access to the table field definitions, you can set the default
value of the desired field to "getdate()", this retrieves the date/time on
the SQL server automatically, no need to specify manually...
hope this helps...
wardeaux

"Bert" <> wrote in message
news:B3465988-5B68-4F55-82BB-...
> I would like to store a Date/Time stamp in a SQL tabel.
> Now only the Date is stred and not the time. How to I get the time also?
>
> This is the code (There is more, but that works):
>
> atSQLexe ex=new atSQLexe();
> ex.addConnection=app.dbConnection;
> sql="INSERT INTO Log (UserID, Date) VALUES (@UserID, @Date)";
> ex.addParm("@UserID",userID);
> ex.addParm("@Date", DateTime.Today);
> try
> {
> ex.ExecuteSQL(sql);
> }



 
Reply With Quote
 
 
 
Reply

Thread Tools

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
SQL Reference, SQL Queries, SQL help ecoolone ASP .Net 0 01-03-2008 10:58 AM
Time stamp problem Zean Smith ASP .Net 0 02-07-2006 03:19 PM
Saving time stamp for replied to email? Keith Firefox 4 01-17-2006 07:03 PM
'URL stamp' extension? hedczech@gmail.com Firefox 1 05-03-2005 08:36 PM
Modifying a file's time stamp ladygrinningsoul Perl 1 12-06-2004 02:36 AM



Advertisments