Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

ASP.NET Forum


You are currently viewing our ASP.NET Forum as a guest. Please register to participate.
Login



Reply
Help with variable in my SQL statement
Old 03-31-2006, 02:16 PM Help with variable in my SQL statement
Average Talker

Posts: 19
Trades: 0
Hello all. I am having trouble upon adding another WHERE clause to my statement:

Code:
 
rsEmpTime.Source = "SELECT *  FROM tblEmpTime  WHERE dbEmpLogin = '" + Replace(rsEmpTime__MMColParam, "'", "''") + "' AND WorkDate = '" & testdate & "'  ORDER BY Counter ASC"
Before adding the 'AND WorkDate' portion, it worked fine, but now I am getting the following error:

Microsoft OLE DB Provider for ODBC Drivers (0x80040E07)
[Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.

Any suggestions?

Thanks,

Parallon
parallon is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 03-31-2006, 02:53 PM Re: Help with variable in my SQL statement
Average Talker

Posts: 19
Trades: 0
Ok, if i change the code to filter for a specific date, it seems to work, but I can't use the variable on that page called 'testdate' to compare. Here is the code that does work:

Code:
 
rsEmpTime.Source = "SELECT *  FROM tblEmpTime  WHERE dbEmpLogin = '" + Replace(rsEmpTime__MMColParam, "'", "''") + "' AND WorkDate = '3/22/2006'  ORDER BY Counter ASC"
Also, I had to set the field type in the database to 'text'.

Thanks,

Parallon
parallon is offline
Reply With Quote
View Public Profile
 
Old 03-31-2006, 03:08 PM Re: Help with variable in my SQL statement
Average Talker

Posts: 19
Trades: 0
I finally got it. I found out that I had my recordsets out of order.

thanks,

Parallon
parallon is offline
Reply With Quote
View Public Profile
 
Old 03-31-2006, 03:21 PM Re: Help with variable in my SQL statement
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,519
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
date variables in access need date literals "#" wrapping around them
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to Help with variable in my SQL statement
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.47647 seconds with 12 queries