Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Distributed Applications / December 2005

Tip: Looking for answers? Try searching our database.

DataReader vs DataSet for Large member search

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
jonefer - 15 Dec 2005 09:40 GMT
I have a prototype which I created in MS Access
It is a fairly simple model, and I would like to take advantage of
VB.NET,ADO.NET and ASP.NET to construct the same model.

The search page has only 4 field parameters and I use 2 Tabs, the first, to
enter the parameters and the 2nd to show a listbox of narrowed results, which
the user can select from to get the final details of a member:

Name_ID, SSN, DOB, SEX

I have a generic query called qMemberSelect
Which is fashioned by the combination of fields the user selects

After this is constructed, a 2nd query filters the list even further for the
Listbox

I guess my main concern is, should I replace the qMemberSelect query with a
DataReader? Or a DataSet?

Below is a brief snipit of how I setup the qMemberSelect to work.

Private Sub cmdFindMember_Click()
Dim strQry As String
Dim qdf As DAO.QueryDef
Dim db As DAO.Database
Dim sSearchChoice As String
Dim sCriteriaDesc As String
Dim lResultCount As Integer

'Logging Variables
Dim NUID As String
Dim dtNow As Date
Dim sAction As String
Dim sOutcome As String
Dim TimeEnd As Date
Dim sScreen As String
Dim sSearchingFor As String

NUID = GetUserNUID
dtNow = Now
sScreen = "Search Screen"

strQry = ""
strQry = "SELECT * FROM MEMBERSHIP "

If IsNull(Me.txtNAME_ID) And IsNull(Me.txt_SSN) And IsNull(Me.txt_DOB) And
IsNull(Me.txt_Sex) Then
   MsgBox "Please enter data in at least one field.", vbInformation, "No
data to search"
   Me.txtNAME_ID.SetFocus
   Exit Sub
End If

'Name/ID only
If Not IsNull(Me.txtNAME_ID) And IsNull(Me.txt_SSN) And IsNull(Me.txt_DOB)
And IsNull(Me.txt_Sex) Then
   If IsNumeric(Me.txtNAME_ID) Then
       strQry = strQry & "WHERE [MRN] = " & Me.txtNAME_ID & ";"
       
       sCriteriaDesc = "MRN: '" & Me.txtNAME_ID & "'"
   Else
       strQry = strQry & "WHERE [MemName] like '" & Me.txtNAME_ID & "*';"

   End If
End If

'Name/ID and SSN
If Not IsNull(Me.txtNAME_ID) And Not IsNull(Me.txt_SSN) And
IsNull(Me.txt_DOB) And IsNull(Me.txt_Sex) Then
       If IsNumeric(Me.txtNAME_ID) Then
       strQry = strQry & "WHERE [MRN] = " & Me.txtNAME_ID & " AND [SSN]
like '" & Me.txt_SSN & "*';"
       
        sCriteriaDesc = "MRN: '" & Me.txtNAME_ID & "'"
   Else
       strQry = strQry & "WHERE [MemName] like '" & Me.txtNAME_ID & "*' AND
[SSN] like '" & Me.txt_SSN & "*';"
   
       sCriteriaDesc = "Member Full Name beginning with: '" & Me.txtNAME_ID
& "'"
   
   End If

‘.... and so on until

Set db = CurrentDb
Set qdf = db.QueryDefs("qMembershipSelect")
qdf.SQL = strQry

db.QueryDefs.Refresh

'--------====================
The 2nd query for the listbox results is as follows:
SELECT DISTINCT MRN,
MemNAME AS Member,
DOB,
SEX,
SSN,
GROUP,
SGR, [FROM-DT], [THRU-DT]
FROM qMembershipSelect AS Y
GROUP BY MRN, MemNAME, DOB, SEX, SSN, GROUP, SGR, [FROM-DT], [THRU-DT]
HAVING [THRU-DT] Is Null Or [THRU-DT] In (Select Max(X.[Thru-Dt]) From  
qMembershipSelect As X Where X.MRN = Y.MRN And X.MRN Not in(Select Z.MRN
From qMembershipSelect  As Z Where Z.[THRU-DT] Is Null))
ORDER BY MemNAME, [FROM-DT] DESC;
Nishith Pathak - 27 Dec 2005 05:30 GMT
hi.

Since you are filtering the query , there are many parameters to decide .
Filterings is very easy in dataset through creation of views and if your
memory is not the big issue and your dataset is not consuming large memory, i
would always suggest you to use the dataSet, In another case, Datareader is a
connected environment strategegy and again if you want to filter, you need to
again connected to the database and while enumerating, you have to read row
by row

hope it helps

regards
Nishith Pathak
http://dotnetpathak.blogspot.com

> I have a prototype which I created in MS Access
> It is a fairly simple model, and I would like to take advantage of
[quoted text clipped - 102 lines]
> From qMembershipSelect  As Z Where Z.[THRU-DT] Is Null))
> ORDER BY MemNAME, [FROM-DT] DESC;

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.