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 / General / October 2004

Tip: Looking for answers? Try searching our database.

Search in DataGrid

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Job Lot - 27 Oct 2004 13:09 GMT
My DataGrid is bound to DataSet which contains relationship between two
tables as follows:

SqlHelper.FillDataset(strConn, CommandType.StoredProcedure,
"spSelectClientApplicant", ds, New String() {"Client", "Applicant"})

ds.Relations.Add("Applicants", ds.Tables("Client").Columns("Client_ID"),
ds.Tables("Applicant").Columns("Client_ID"))

grdDetails.DataSource = ds.Tables("Client").DefaultView

My form provides three search criteria Client ID, Applicant First Name,
Applicant Last Name. Now my problem is how can I implement search capability
for the DataGrid. I want my search to look for records for the provided
Client ID or do a wildcard character search for provided Applicant First
Name, Last Name.

Thanks
Ben Lucas - 27 Oct 2004 15:22 GMT
Depends on where you want the search to happen, which will also depend on
how much data you're talking about.

You can either set up your stored procedure to perform the search, in which
case it will need to take in the parameters for the search, or you can use a
DataView to filter records that you have already received (and the stored
procedure would just return all records).

I would only use the latter if you know that there will not be very much
data; I think you're probably better off making your stored procedure
perform the search.

Signature

Ben Lucas
Lead Developer
Solien Technology, Inc.
www.solien.com

> My DataGrid is bound to DataSet which contains relationship between two
> tables as follows:
[quoted text clipped - 15 lines]
>
> Thanks
Kannan.V - 27 Oct 2004 18:55 GMT
hi job,

You can do a search for the data by searching the dataset that is used to
bind to the grid.
You can use the following syntax to get the rows that match a certain
criteria fromthe dataset.

dataset myDS = new dataset(.......);
myDS.select("FirstName = '" + nameSearch + "'");

Wild card character searches can also be performed with similar syntax as
SQL LIKE.

nyDS.Select("FirstName LIKE 'A%'");

Hope the above explanation helps you,
Kannan.V
http://kannanv.blogspot.com

> My DataGrid is bound to DataSet which contains relationship between two
> tables as follows:
[quoted text clipped - 14 lines]
>
> Thanks
Job Lot - 29 Oct 2004 01:19 GMT
Hi

To start with there no Select method for DataSet.

Secondly, I am showing master detail records in my DataGrid using DataSet's
Relation object. Client_ID is part of master DataTable and FirstName,
LastName are part of detailed DataTable. How would i filter my records based
on detailed DataTable

> hi job,
>
[quoted text clipped - 33 lines]
> >
> > Thanks

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.