473,804 Members | 3,138 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Global Date Filter for DataAdapter?

I've a DataAdapter with:

SELECT ID, Employee, [Date], Period_End_Date , Job, Description, Exported,
Units, Cost_Code, Category, Class, Chargeout_Level , PayID, Rate
FROM tblTimeEntry
WHERE (Employee LIKE ?) AND (Period_End_Dat e = ?)
ORDER BY [Date]

I then get my Data by the following:

' Select Data Based upon Current Week Ending and Employee ID
daUserData.Sele ctCommand.Param eters.Add("@Emp loyee", OleDbType.Char. Char, 10)
daUserData.Sele ctCommand.Param eters.Add("@MyD ateField ", OleDbType.Date)
daUserData.Sele ctCommand.Param eters(0).Value = strUserID
daUserData.Sele ctCommand.Param eters(1).Value = WeekEndDate
daUserData.Fill (DsUserData.tbl TimeEntry)

with the 'date' variable WeekEndDate I choose a 'specific' date.

What I'd like to know, is what do I use as a 'global' search for ALL dates
using the above?

"%" and "*" of course do not work as I have to search a 'DATE'.

Anyone know?

Thanks

Toby
Jul 21 '05 #1
14 1865
Hi Toby,

You cannot use any wildcards for the dates. What you could do here is to use
SQL statement without date condition or use doubled condition for the date
and pass range of the dates, which basically covers everything. Something
like

SELECT ID, Employee, [Date], Period_End_Date , Job, Description,
Exported,
Units, Cost_Code, Category, Class, Chargeout_Level , PayID, Rate
FROM tblTimeEntry
WHERE (Employee LIKE ?) AND Period_End_Date >= ? AND Period_End_Date <=
?
ORDER BY [Date]

daUserData.Sele ctCommand.Param eters.Add("@Emp loyee", OleDbType.Char. Char,
10)
daUserData.Sele ctCommand.Param eters.Add("@MyD ateField1", OleDbType.Date)
daUserData.Sele ctCommand.Param eters.Add("@MyD ateField2", OleDbType.Date)
daUserData.Sele ctCommand.Param eters(0).Value = strUserID
daUserData.Sele ctCommand.Param eters(1).Value = WeekStartDate
daUserData.Sele ctCommand.Param eters(2).Value = WeekEndDate
daUserData.Fill (DsUserData.tbl TimeEntry)

In case wehn you need to check for one date, you could pass it as a value
for both parameters

--
Val Mazur
Microsoft MVP
Check Virus Alert, stay updated
http://www.microsoft.com/security/incident/blast.asp
"Toby" <pl****@PostTo. NGs> wrote in message
news:tr******** *************** *********@4ax.c om...
I've a DataAdapter with:

SELECT ID, Employee, [Date], Period_End_Date , Job, Description, Exported, Units, Cost_Code, Category, Class, Chargeout_Level , PayID, Rate
FROM tblTimeEntry
WHERE (Employee LIKE ?) AND (Period_End_Dat e = ?)
ORDER BY [Date]

I then get my Data by the following:

' Select Data Based upon Current Week Ending and Employee ID
daUserData.Sele ctCommand.Param eters.Add("@Emp loyee", OleDbType.Char. Char, 10) daUserData.Sele ctCommand.Param eters.Add("@MyD ateField ", OleDbType.Date) daUserData.Sele ctCommand.Param eters(0).Value = strUserID
daUserData.Sele ctCommand.Param eters(1).Value = WeekEndDate
daUserData.Fill (DsUserData.tbl TimeEntry)

with the 'date' variable WeekEndDate I choose a 'specific' date.

What I'd like to know, is what do I use as a 'global' search for ALL dates
using the above?

"%" and "*" of course do not work as I have to search a 'DATE'.

Anyone know?

Thanks

Toby

Jul 21 '05 #2
On Sat, 8 Nov 2003 23:12:44 -0500, in microsoft.publi c.data.ado you wrote:
You cannot use any wildcards for the dates. What you could do here is to use
SQL statement without date condition or use doubled condition for the date
daUserData.Sele ctCommand.Param eters(1).Value = WeekStartDate
daUserData.Sele ctCommand.Param eters(2).Value = WeekEndDate


Okay... I recall seeing this start-end date once. But didn't realize that it
was my only option.

Thanks!

I'll take it from here on!

Toby
Jul 21 '05 #3

"Val Mazur" <gr******@hotma il.com> wrote in message
news:Oy******** *****@TK2MSFTNG P10.phx.gbl...
Hi Toby,

You cannot use any wildcards for the dates. What you could do here is to use SQL statement without date condition or use doubled condition for the date
and pass range of the dates, which basically covers everything. Something
like

SELECT ID, Employee, [Date], Period_End_Date , Job, Description,
Exported,
Units, Cost_Code, Category, Class, Chargeout_Level , PayID, Rate
FROM tblTimeEntry
WHERE (Employee LIKE ?) AND Period_End_Date >= ? AND Period_End_Date <= ?
ORDER BY [Date]


If your SQL dialect supports it, consider changing the two tests for the
date criteria to a single test using the BETWEEN clause. Something like
this :

AND Period_End_Date BETWEEN ? AND ?

regards
roy fine


Jul 21 '05 #4
With Deft Fingers, "Roy Fine" <rl****@twt.obf uscate.net> wrote:
If your SQL dialect supports it, consider changing the two tests for the
date criteria to a single test using the BETWEEN clause. Something like
I'm using OLE and an Access DB file.
AND Period_End_Date BETWEEN ? AND ?


I'll see if this works too.

Thanks!

Toby
Jul 21 '05 #5
Hi,

Yes, it supports BETWEEN

--
Val Mazur
Microsoft MVP
Check Virus Alert, stay updated
http://www.microsoft.com/security/incident/blast.asp
"Toby" <pl****@PostTo. NGs> wrote in message
news:1r******** *************** *********@4ax.c om...
With Deft Fingers, "Roy Fine" <rl****@twt.obf uscate.net> wrote:
If your SQL dialect supports it, consider changing the two tests for the
date criteria to a single test using the BETWEEN clause. Something like


I'm using OLE and an Access DB file.
AND Period_End_Date BETWEEN ? AND ?


I'll see if this works too.

Thanks!

Toby

Jul 21 '05 #6
>Yes, it supports BETWEEN

What I found interested (not sure if this is correct)... is that now with the
WeekStart and WeekEnd search... my loading of the application has increased (5
seconds or so out of 10 normally).

Would this be 'typical'?

Toby
Jul 21 '05 #7
Hi Toby,

If you do not have indexes created for those fields, then yes, you could
expect it. You should build indexes on a fields, involved into search by
WHERE clause

--
Val Mazur
Microsoft MVP
Check Virus Alert, stay updated
http://www.microsoft.com/security/incident/blast.asp
"Toby" <pl****@PostTo. NGs> wrote in message
news:v1******** *************** *********@4ax.c om...
Yes, it supports BETWEEN
What I found interested (not sure if this is correct)... is that now with

the WeekStart and WeekEnd search... my loading of the application has increased (5 seconds or so out of 10 normally).

Would this be 'typical'?

Toby

Jul 21 '05 #8
>If you do not have indexes created for those fields, then yes, you could
expect it. You should build indexes on a fields, involved into search by
WHERE clause


Indexes? Hmmm... not sure by what you mean.

Sorry... I've only been using DBs for about 1-1/2 months now. And while I've
learnt a lot... I'm still out of my depth here sometimes :(

Toby
Jul 21 '05 #9
Hi,

Index allows you to boost selection from the table. When you create index,
for the specific field(s), then database maintains it to provide faster
search. I would suggest you to read about databases structure and how to
create indexes. This is not a five minutes topic. If you do not create
appropriate indexes, then you should expect slow selection from the database

--
Val Mazur
Microsoft MVP
Check Virus Alert, stay updated
http://www.microsoft.com/security/incident/blast.asp
"Toby" <pl****@PostTo. NGs> wrote in message
news:pq******** *************** *********@4ax.c om...
If you do not have indexes created for those fields, then yes, you could
expect it. You should build indexes on a fields, involved into search by
WHERE clause
Indexes? Hmmm... not sure by what you mean.

Sorry... I've only been using DBs for about 1-1/2 months now. And while

I've learnt a lot... I'm still out of my depth here sometimes :(

Toby

Jul 21 '05 #10

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

Similar topics

4
2498
by: Stewart Allen | last post by:
I'm trying to filter a table that has 2 date fields, the first date will always have a value but the second will only occasionally has a value. Each date field also has a corresponding text field to record the record's status. Sample data: *tblTest* Model Parts CDate CStatus RDate RStatus 616 $359.79 03-Nov-03 C
33
3059
by: MLH | last post by:
I've read some posts indicating that having tons of GV's in an Access app is a bad idea. Personally, I love GVs and I use them (possibly abuse them) all the time for everything imaginable - have been for years. If the machine has memory to spare and windows can use it - I'm thinking "Why not?" I was wondering what some of you have to say about that, particularly any severe "gotchas" you've had the unfortunate experience to contend with.
7
2924
by: Adam | last post by:
Im trying to add an httphandler for all *.sgf file extensions. I have developed the handler, 1. installed it into the gac 2. added it to the machine.config: <httpHandlers> <add verb="*" path="*.sgf" type="CustomExtensionHandler, Extenders.CustomExtensionHandler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d831d925597c1031" validate="True"/> </httpHandlers>
0
1759
by: Rick Hein | last post by:
I've got a problem with an app I've been working on, the Caching object and events not firing correctly. In a nutshell: When I'm debugging, and I set a breakpoint in the removed item call back, the code works correctly. If there is no debugger it doesn't fire, which causes the app to have problems. Here's what the code does: The TemplateData class inherits from the DataSet Object, in the constructor it loads itself with Data from an XML...
14
313
by: Toby | last post by:
I've a DataAdapter with: SELECT ID, Employee, , Period_End_Date, Job, Description, Exported, Units, Cost_Code, Category, Class, Chargeout_Level, PayID, Rate FROM tblTimeEntry WHERE (Employee LIKE ?) AND (Period_End_Date = ?) ORDER BY I then get my Data by the following:
2
1675
by: JohnT | last post by:
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:
4
4223
by: Mark Olbert | last post by:
I have several ASP.NET 1.1 websites where I centralized a read-only dataset (i.e., one which no web page ever changed) and its associated SqlDataAdapters. In 2.0 I noticed that the Global.asax file does not have a design surface, so I can't drag and drop database components onto it. I could configure all this stuff manually, but that would be a lot of work duplicating what the visual designers do just fine. Besides, it would put me way...
12
2614
by: Rob Meade | last post by:
Hi all, Ok - I've come from a 1.1 background - and previously I've never had any problem with doing this: Response.Write (Session("MyDate").ToString("dd/MM/yyyy")) So, I might get this for example: 21/05/2006
6
8367
by: fonzie | last post by:
Is there any way to include two unbound text boxes (for a start date and end date) to a filter-by-form? The users may want to filter by several different fields and they may want to include a date range search on the one date field. Instead of having the users type in
0
9706
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10578
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10332
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10321
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9152
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7620
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5522
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4300
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2991
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.