trouble inserting date and time 
Author Message
 trouble inserting date and time

Using SS2000 and VB6. I want to insert the date and time into a column. I
tried using datetime and smalldatetime for the column type. The piece of
code in the VB program is basically this:

Dim processed as string
processed = Now()

I've run it through the de{*filter*} and right before the insert statement the
processed variable data will look like this: 2003-06-13 02:23:08 PM but
after the data is inserted and I run a query, the data looks like this:
2003-06-13 00:00:00

I've tested this at home with the same versions of the programs and it works
fine.

Any ideas?

Thanks,

Dan



Wed, 30 Nov 2005 03:18:46 GMT  
 trouble inserting date and time

Quote:
> Using SS2000 and VB6. I want to insert the date and time into a
> column. I tried using datetime and smalldatetime for the column type.
> The piece of code in the VB program is basically this:

> Dim processed as string
> processed = Now()

You should never rely on VB's default formatting; on my system the resulting
string would not work because the default date formats are not valid for sql
date/time fields.

processed=format$(now,"yyyy-mm-dd hh:nn:ss")

Quote:
> I've run it through the de{*filter*} and right before the insert
> statement the processed variable data will look like this: 2003-06-13
> 02:23:08 PM but after the data is inserted and I run a query, the
> data looks like this: 2003-06-13 00:00:00

> I've tested this at home with the same versions of the programs and
> it works fine.

sounds like the field in the table is defined so that it only holds the date
and not the time and you need to change the table definition


Wed, 30 Nov 2005 05:28:33 GMT  
 trouble inserting date and time
I've changed between datetime and smalldatetime several times. Both of them
worked at home. I'll try your formatting suggestion. Thanks,

Dan


Quote:


> > Using SS2000 and VB6. I want to insert the date and time into a
> > column. I tried using datetime and smalldatetime for the column type.
> > The piece of code in the VB program is basically this:

> > Dim processed as string
> > processed = Now()

> You should never rely on VB's default formatting; on my system the
resulting
> string would not work because the default date formats are not valid for
sql
> date/time fields.

> processed=format$(now,"yyyy-mm-dd hh:nn:ss")

> > I've run it through the de{*filter*} and right before the insert
> > statement the processed variable data will look like this: 2003-06-13
> > 02:23:08 PM but after the data is inserted and I run a query, the
> > data looks like this: 2003-06-13 00:00:00

> > I've tested this at home with the same versions of the programs and
> > it works fine.

> sounds like the field in the table is defined so that it only holds the
date
> and not the time and you need to change the table definition



Fri, 02 Dec 2005 06:52:37 GMT  
 trouble inserting date and time
I tried formatting the date/time but the time still shows as 00:00:00. I
tried setting the column type to both datetime and smalldatetime.

Any other ideas?

Thanks,

Dan


Quote:


> > Using SS2000 and VB6. I want to insert the date and time into a
> > column. I tried using datetime and smalldatetime for the column type.
> > The piece of code in the VB program is basically this:

> > Dim processed as string
> > processed = Now()

> You should never rely on VB's default formatting; on my system the
resulting
> string would not work because the default date formats are not valid for
sql
> date/time fields.

> processed=format$(now,"yyyy-mm-dd hh:nn:ss")

> > I've run it through the de{*filter*} and right before the insert
> > statement the processed variable data will look like this: 2003-06-13
> > 02:23:08 PM but after the data is inserted and I run a query, the
> > data looks like this: 2003-06-13 00:00:00

> > I've tested this at home with the same versions of the programs and
> > it works fine.

> sounds like the field in the table is defined so that it only holds the
date
> and not the time and you need to change the table definition



Fri, 02 Dec 2005 22:27:57 GMT  
 trouble inserting date and time
I figured it out. In my insert statement, I was using another date variable
instead of the "processed" variable. Thanks.

Quote:


> > Using SS2000 and VB6. I want to insert the date and time into a
> > column. I tried using datetime and smalldatetime for the column type.
> > The piece of code in the VB program is basically this:

> > Dim processed as string
> > processed = Now()

> You should never rely on VB's default formatting; on my system the
resulting
> string would not work because the default date formats are not valid for
sql
> date/time fields.

> processed=format$(now,"yyyy-mm-dd hh:nn:ss")

> > I've run it through the de{*filter*} and right before the insert
> > statement the processed variable data will look like this: 2003-06-13
> > 02:23:08 PM but after the data is inserted and I run a query, the
> > data looks like this: 2003-06-13 00:00:00

> > I've tested this at home with the same versions of the programs and
> > it works fine.

> sounds like the field in the table is defined so that it only holds the
date
> and not the time and you need to change the table definition



Fri, 02 Dec 2005 22:57:33 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Compare date in form with date/time in form with date/time in database

2. Have troubles with a Date/Time field in access

3. Insert Time/Date stamp

4. Need Code that will Insert Date and Time

5. Insert current date and time

6. insert file by modified date and time

7. VBA Code to Insert Path/Filename/Date/Time at end of document

8. Insert date and time field into MS Access with SQL

9. Insert Date&Time into Filename

10. Insert Date&Time into Filename

11. Insert date/time value into Oracle using VB6?

12. Inserting a date and time value in an MSDE database

 

 
Powered by phpBB® Forum Software