English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Kindly explain to me how to store datetime in SQL Server 2000 using Visual Basic 6.0.... right now im using 2 fields (date and time) instead of 1 field only. I tried to combine date and time to store in SQL Server but there's always an error. Examples is greatly appreciated. Thanks!

2007-02-02 20:10:34 · 3 answers · asked by Raphael T 1 in Computers & Internet Programming & Design

3 answers

You should be asking this question in another forum where people are encouraged to have a dialog. This forum encourages answers, but, for example, I get no notification if you ever post a response to this question:

What Error are you getting?

So if I forget about this or for some other reason I don't come back to it, then you may never get an answer. Forums I would suggest include www.experts-exchange.com and www.tek-tips.com

In short, in a datetime SQL field, SQL stores dates and times in the format (at least the default US format):
MM/DD/YYYY HH:MM:SS xM
As long as you're attempting to insert/update the field using that format, it should work fine (it's what I do). Make sure you have a space between the YYYY and HH - without it, it looks like this, for example:
02/03/200701:19:27 AM
And that won't work - but this SHOULD work:
02/03/2007 01:19:27 AM

And there can be some variation on the time - for example, you can use a 24hour based time like 13:34:22 or you can use a 12 based time and specify AM/PM like 1:34:22 PM

2007-02-02 20:20:46 · answer #1 · answered by lwcomputing 6 · 0 0

considering sq. 2008 has been out for a lengthy time period i'd stay remote from 2000 and concentrate on 2005 and 2008. do not anticipate any keep could have a unmarried version of the DB round. we are at the moment deploying 2008 for brand new platforms we setup and cutting-edge 2005 platforms will be migrated over the subsequent year. i does no longer waste any time on 2000 except there's a particular activity you're going for that makes use of it.

2016-11-24 20:40:19 · answer #2 · answered by vernell 4 · 0 0

Hi there, try the following code as example.

By Query Analyser or create direct by Enterprise Manager
Add new field in table.

Alter Table myTable
Add myDate as datetime
Go

In Visual Basic.
Dim rsTable as New Recordset
rsTable.Open "myTable", myConnection, 1, 3
rsTable.AddNew
rsTable("myDate") = Now()
rsTable.Update

2007-02-02 20:56:17 · answer #3 · answered by Saqib Ansari 2 · 0 0

fedest.com, questions and answers