Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Date error on win98 but not winxp or win2k

Posted on 2003-11-12
4
Medium Priority
?
529 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

927 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