473,387 Members | 1,722 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Datatable.select

Hi All

I am using Access 2003 and VS 2005 Professional

I retrieve data from an access DB into a datatable then need to select rows
that match a short time value

I can retrieve by time from Access OK
e.g sql = "Select [Details], [mytime], [endtime], [mydate], [member] from
[appointments] where [instructornumber] = " & instructornumber & " and
[mydate] = #" & Format(mydate, "MMM d, yyyy") & "# and [mytime] =
#" & Format(dr("Time"), "t") & "# order by mydate"
dtweek = getdata(sql)

but I can't get the datatable.select to return rows with the same matching
criteria
e.g
drrows = dtweek.Select("mydate = #" & Format(mydate, "MMM d, yyyy") & "#
AND mytime = #" & Format(dr("Time"), "t") & "#")

In the sql line 'mydate' is an access 2003 DateTime field with a format of
Medium Time
In the select line dr("Time") is a datacolumn from a datatable of type
System.DateTime

The following works OK... drrows = dtweek.Select("mydate = #" &
Format(mydate, "MMM d, yyyy") & "#")
It is the time field that is the problem

Any ideas please

Regards
Steve
Jan 6 '06 #1
1 2256
Hi steve,

The datatable engine is not so powerful as the Jet is. It cannot parse all
the formats of DateTime that Jet does. When filtering a date from
DataTable, I suggest you try to use #mm/dd/yyyy# like "Birthdate <
#1/31/82#".

Also, it is not safe to concatenate strings to build the SQL statement.
Hackers can use injection attack with this. You can use the Parameters to
get over this.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Jan 6 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: randy | last post by:
Hello all, I have a DataTable which I am building column by column and adding rows after each new column. The DataTable columns match the columns in my database table. I'm building the...
5
by: Stefan Turalski \(stic\) | last post by:
Hi, I'm wondering if there is a way to send a method parametrs by ref when DataTabel is a type of this value ? I done some sort of select over DataTable columns, just by removing them froma...
5
by: randy | last post by:
Hello all, I have a DataTable which I am building column by column and adding rows after each new column. The DataTable columns match the columns in my database table. I'm building the...
7
by: wk6pack | last post by:
Hi, How do I check datatable.select(filter) in the following: for each dtrow in datatable.select(filter) .... next I've also tried:
6
by: fniles | last post by:
I am using VB.NET 2005 and Access database. My program uses a timer that kicks in every 1 min to read from a database and copy the dataset table to a datatable. This database is in a class called...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.