Can u pls help me solve this problem
iam using vb6.0 and sql 2000. when i insert the currnt date (as Now()) in the dbase with a colunm datatype date/time, it inserts the date 01/01/1900.
In MSAccess it works by putting a # b4 and after the date e.g. #25/06/2010#
but it does not work with sql2000.

OR SQL2000 DOES NOT SUPPORT VB6 ?? OR IS IT SOME MISSING DRIVERS??
pls help

Recommended Answers

All 4 Replies

Can u pls help me solve this problem
iam using vb6.0 and sql 2000. when i insert the currnt date (as Now()) in the dbase with a colunm datatype date/time, it inserts the date 01/01/1900.
In MSAccess it works by putting a # b4 and after the date e.g. #25/06/2010#
but it does not work with sql2000.

OR SQL2000 DOES NOT SUPPORT VB6 ?? OR IS IT SOME MISSING DRIVERS??
pls help

I've not used SQL server much with VB6 but looking at the date show I'd say its SQL Servers base date, so I would guess that the error is in the code somewhere and it is not writing the date! Can you maybe post the connection string and the insert code line which would help in giving you a solution!

Make the date a string...

...dDateField = '" & Now & "'"

Good Luck

i think the it's a problem of sql server 2000.
first try to insert into table through query anlyzer. when i was doing some time it heppen reason is the default formate of sql 2000 for dattime is MM/dd/YYYY hh:mm:ss and so on. and when we pass the date as dd/MM/YYYY so it take s the default date i.e.01/01/1900.
some time it allwos and some time it not so try with it.

Track down changes on database using Sql Profiler. With this tool you can see if it is sql's problem or VB's - it shows the exact values your code passes for the insert.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.