custom sql query ?

robbie_62

Member
Joined
Jan 27, 2003
Messages
18
Location
ireland
hi all,

im working with an access db,and im creating the adapter,connection,etc in code.

I have generated everythibg ok, and can load my data into a datagrid no problem.

ive made a change to my select statement in code now.

Id like to only load the data from the database that matches a certan date that i pick at runtime
When the user selects the date,i create the adapter,connection,etc and load in the data.

eg -
"Select * from tbl where date = " txt_date.text

I even tried just typing in a date like

"Select * from tbl where date = 19/06/03"

and it doesnt load any data either??

I dont get any errors,it justs doesnt show me any data.

any ideas ??
 
date!

if your field in access is a date type try using

for example:

dim myDate as Date
myDate = #1/1/03#
"Select * from tbl where date = myDate"

Use the pound sign to denote a date type in VB, The single quote wont work I would also suggest not to use date as your column name in your database it could cause problems.


Topmade.
 
Single quotes for SQL Server/MSDE.
Pound sound for Access.

What you use has to do with the database youre using, not the language.
 
sql query

hi guys,

yes my db is in access,my field in the db is called dateno

ive tried using the sign,the # sign,the sign and still not loading in the data i want.

any ideas guys
 
Your query should look like
Select * from tbl where date = #" & txt_date.text & "#"

and the format of date should be mm/dd/yyyy
 
Back
Top