Running a simple query

  • Thread starter Thread starter John
  • Start date Start date
J

John

Hi

What is the easiest way to get a bunch of records from an access table based
on a where condition? I don't need to write back anything, just want to
check if any records matching a certain condition exist in the table.

Thanks

Regards
 
Hi John,

I suggest you using OleDbReader and OleDbCommand.ExecuteReader or just
OleDbCommand.ExecuteScalar if you are interested in just first field of
first record.
 
Hi

I am using this sql string;

Dim SQLStr As String = "SELECT * FROM tbltasks WHERE ([DateRemind] > '" &
DateTime.Now.ToString() & "') AND ([DateCompleted] is system.dbnull.value)"

and I am getting an error on 'is' operator. How do I test for null on an
access datetime field?

Thanks

Regards



Miha Markic said:
Hi John,

I suggest you using OleDbReader and OleDbCommand.ExecuteReader or just
OleDbCommand.ExecuteScalar if you are interested in just first field of
first record.

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

John said:
Hi

What is the easiest way to get a bunch of records from an access table based
on a where condition? I don't need to write back anything, just want to
check if any records matching a certain condition exist in the table.

Thanks

Regards
 
John said:
Hi

I am using this sql string;

Dim SQLStr As String = "SELECT * FROM tbltasks WHERE ([DateRemind] > '" &
DateTime.Now.ToString() & "') AND ([DateCompleted] is system.dbnull.value)"
and I am getting an error on 'is' operator. How do I test for null on an
access datetime field?


([DateCompleted] is Null)
system.dbnull.value is .net's stuff.
 
Back
Top