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
Solved

Date error on win98 but not winxp or win2k

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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Copy a row 12 64
How to hault or freeze parent form when a 2d form is open in vb6 3 40
Help me. 3 60
VB6 ListBox Question 4 48
There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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…

839 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