Welcome to the dBforums forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

If you prefer not to see double-underlined words and corresponding ads, place your cursor
here for ContentLink opt out.

Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > SQL cast operators in MS Access

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-17-03, 05:43
neven neven is offline
Registered User
 
Join Date: Apr 2003
Posts: 1
SQL cast operators in MS Access

Hi,

I'm trying to "connect" two fields of the diferent types, one of them is STRING, and the other is DATE.

SELECT firstName, lastName
FROM tblPerson, tblPerson1
WHERE tblPerson.Date = tblPerson1.Date
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AND tblPerson.Date LIKE '7.4.2003'

tblPerson.Date is STRING type field
tblPerson1.Date is DATE type field

I've tried using in my ASP code:
WHERE tblPerson.Date = CStr(tblPerson1.Date)

but when I execute the query, the recordset is empty.
The thing is, when I try the same query in MS Access query editor, it works !?!?

Please help, Neven
Reply With Quote
  #2 (permalink)  
Old 04-21-03, 22:33
MrWizard MrWizard is offline
Registered User
 
Join Date: Mar 2003
Location: Atlanta, GA
Posts: 191
let's see...

I'm no expert on field type issues, but since you say it works fine in MSAccess, I would try:

WHERE CStr(tblPerson.Date) = CStr(tblPerson1.Date)

or CDate(tblPerson.Date) = tblPerson1.Date


Tim
__________________
Tim
Reply With Quote
  #3 (permalink)  
Old 05-09-03, 13:51
aaron_kempf aaron_kempf is offline
Registered User
 
Join Date: Feb 2003
Posts: 110
also could be a problem with time

you could be having a problem where you

are trying to join where '3/13/2003' = '3/13/2003 6:00am' and it isnt matching.
__________________
Access 2002 ADP Rocks my World

Long live SQL Server and 64bit Windows!!!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

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