Q: DataAdapters and Global WildCard Searches

  • Thread starter Thread starter JohnT
  • Start date Start date
J

JohnT

Okay... I'm using VB.net (2003) and I am accessing an MS Access DB file.

I have two DataAdapters that I use to search for specific info. The two of
them are similar except one is a Date, the other is a String.

Currently they both work as I like and I can get my data as I want. What I'm
intersted in is seeing HOW I do a Global search for both cases. Here are my
two issues:

ISSUE 1:
Dates... in my SELECT I search for a date using something like:

.... WHERE MyDate = ?
.... then...
daMyData.SelectCommand.Parameters(0).Value = WeekEndDate
daMyData.Fill(DsMyData.MyDataTable)

If I want to get ALL of my data regardless of the Date, I've figured out that
I can add in a 2nd Parameter (ie: most earliest date to most latest date).
Thus I get the data between the two dates.

.... WHERE MyDate BETWEEN ? and ?
.... then...
daMyData.SelectCommand.Parameters(0).Value = StartDate
daMyData.SelectCommand.Parameters(1).Value = EndDate
daMyData.Fill(DsMyData.MyDataTable)

My question is: IS this the correct way (using 2 parameters)? Or is there
some kind of Global search (ie: * ) for a Date using my original single
Parameter?


ISSUE 2:
Strings: Similar to the above, I do a search for a string:

.... WHERE MyData = ?
.... then...
daMyData.SelectCommand.Parameters(0).Value = FindData
daMyData.Fill(DsMyData.MyDataTable)

So my question is: HOW do I do a global wildcard search (ie: * ) for a String?
If this is at alll possible.

Basically the two issues are for when I want to see ALL of my data rather than
specific search criteria.

Is it just that I have to create a new DataAdapter/Set where I don't do any
WHERE statement?

Appreciate any input.

JohnT
 
JohnT,

First of all, SQL for Access is much limited than for most other
databaseServers.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnacc2k/html/acfundsql.asp

See as well the links to the additional resources at the bottom of this
article

Although I am strugling with this one as well forever.

I my opinion do you do it very it correct and than my idea is, why not just
replace the selectString (or SP) in your commandText for one without the
WHERE clause?

That you fill than the parameters does not harm at all.

I hope this helps,

Cor
 
First of all, SQL for Access is much limited than for most other
databaseServers.
Understood.

I my opinion do you do it very it correct and than my idea is, why not just
replace the selectString (or SP) in your commandText for one without the
WHERE clause?

That you fill than the parameters does not harm at all.

I hope this helps,

Thank you Sir... I'll play with it some and see where I get!

JohnT
 
Back
Top