date selection not working in sql

  • Thread starter Thread starter Starbuck
  • Start date Start date
S

Starbuck

Hi

The following SQL statement returns what I would expect
"select * from polls where ref = '" + ref + "' order by jobDate"
This one always fails
"select * from polls where ref = '" + ref + "' and jobdate = #" +
CType(sdate, string) + "# order by jobDate"
Anyone know why? We are using VB.Net & ADO to Jet Database

Thanks in advance
 
Hi,

You should check what value is returned by CType(sdate, string).
According to docs the date should be in format #month/day/year".
 
Thanks

You sent me in the right direction

Regards

Miha Markic said:
Hi,

You should check what value is returned by CType(sdate, string).
According to docs the date should be in format #month/day/year".

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com

Starbuck said:
Hi

The following SQL statement returns what I would expect
"select * from polls where ref = '" + ref + "' order by jobDate"
This one always fails
"select * from polls where ref = '" + ref + "' and jobdate = #" +
CType(sdate, string) + "# order by jobDate"
Anyone know why? We are using VB.Net & ADO to Jet Database

Thanks in advance
 
Back
Top