If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
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, 04: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, 21: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, 12:51
aaron_kempf aaron_kempf is offline
Registered User
 
Join Date: Feb 2003
Posts: 109
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

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