Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Date error on win98 but not winxp or win2k

Posted on 2003-11-12
4
Medium Priority
?
528 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

715 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