Solved

Date error on win98 but not winxp or win2k

Posted on 2003-11-12
4
515 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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

758 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

20 Experts available now in Live!

Get 1:1 Help Now