473,394 Members | 1,722 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Search in DataGrid

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

Jul 21 '05 #1
3 4302
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.

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

"Job Lot" <Jo****@discussions.microsoft.com> wrote in message
news:DA**********************************@microsof t.com...
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

Jul 21 '05 #2
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

"Job Lot" wrote:
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

Jul 21 '05 #3
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

"Kannan.V" wrote:
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

"Job Lot" wrote:
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

Jul 21 '05 #4

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

Similar topics

3
by: serge calderara | last post by:
Dear all, I am using a datagrid which is populate from an array list items This array list can be updated at anytime.If this occurs I need that the content of the datagrid get synchronise too. ...
4
by: rh | last post by:
Hi, I'd like to add an incremental search to my windows form DataGrid that works like the one used in Windows Explorer. In Windows Explorer, when you type a character it jumps to the first item...
0
by: CSDProgrammers | last post by:
I have a standard .NET DataGrid that is bound to a DataView. When the user types into a text box above the DataGrid I issue the following code: try { // We need to search for whatever the user...
2
by: Sriram | last post by:
Hi, i am developing a search page, basically using datagrid. i have given a column as hyperlink so that when the user clicks on it, it gives the details of the selected item in a seperate page....
3
by: Job Lot | last post by:
My DataGrid is bound to DataSet which contains relationship between two tables as follows: SqlHelper.FillDataset(strConn, CommandType.StoredProcedure, "spSelectClientApplicant", ds, New String()...
1
by: David Cortés | last post by:
Hi all It is possible to search inside a datagrid? I have a bound datagrid, and I want to search in my datagrid and select the row that match with the search. Thanks for all
0
by: Savvas | last post by:
Hi, I am using VB.Net 2005 for a windows application. The application was actually upgraded from vb.net 2003. I have a search field which is used as a parameter to search all datagrid...
0
by: | last post by:
I have a question about spawning and displaying subordinate list controls within a list control. I'm also interested in feedback about the design of my search application. Lots of code is at the...
0
by: JamesOo | last post by:
I have the code below, but I need to make it searchable in query table, below code only allowed seach the table which in show mdb only. (i.e. have 3 table, but only can search either one only,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.