Solved

Date error on win98 but not winxp or win2k

Posted on 2003-11-12
4
517 Views
Last Modified: 2012-05-04
Hi all,
 
Still a continuation from yesterday error that I posted. Why is the following query an error on win 98 but not on win2k and xp ? I have installed  the latest MDAC 2. 8  on the win98 machine. The connection is to SQL server 2000. Here's where the error occured :
 
set db = new connection
set rs = new recordset
 
db.open "SQLconnection", "Admin", "Blank"
kode = combo1.text ' combo1 held the value of a date, in this case the date is 8/8/2003
querys = "select * from exchangecurr where date = convert(varchar, convert(datetime '" & kode & "', 101), 110)"]
rs.open querys, db, adopenstatic, adlockoptimistic

when trying to execute : rs.open, the following error occured :

Run Time Error '-2147217913 (80040e07)':
[Microsot][ODBC SQL Server Driver][SQL Server]Syntax Error converting datetime from character string.

The error is always regarding datetime data. When I try to do the query directly without the convert syntax other error occured. Anyone know what is wrong or what I should install on the win98 machine ? I have also installed the VB 6 sp5 runtime files on the win98 machine .  

Thanks
0
Comment
Question by:hama-ayu-ism
  • 2
4 Comments
 
LVL 3

Expert Comment

by:monvelasquez
ID: 9737323
you may need to specify a length for the varchar..

--[CODE]-------------------------------------------------------------------------------------------------------------------------

querys = "select * from exchangecurr where date = convert(varchar(10), convert(datetime, '" & kode & "', 101), 110)"

--[/CODE]------------------------------------------------------------------------------------------------------------------------

is this just a typo...

--[CODE]-------------------------------------------------------------------------------------------------------------------------

querys = "select * from exchangecurr where date = convert(varchar, convert(datetime, '" & kode & "', 101), 110)"

--[/CODE]------------------------------------------------------------------------------------------------------------------------
0
 

Accepted Solution

by:
hama-ayu-ism earned 0 total points
ID: 9738102
Hi monveslasquez,

I have found out what cause that !! It turns out that the standard "format" for date in win98 is mm/dd/yy ... the standard date "format" for win2k/xp is mm/dd/yyyy ...  Now, the 2 date year thing is what's tricking the SQL server !!! causing the error everytime I try to do a query from win98 machine, cause I'm passing yyyy instead of yy, and win98 doesn't recognize it !

Been banging my head since yesterday, and have only got a solution from a mailing list from someone who have the same problem.

I'm going to have this question deleted.

Thanks
0
 

Author Comment

by:hama-ayu-ism
ID: 9744576
hi RomMod,

Thanks a lot ^_^
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now