473,569 Members | 2,762 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Search in DataGrid

My DataGrid is bound to DataSet which contains relationship between two
tables as follows:

SqlHelper.FillD ataset(strConn, CommandType.Sto redProcedure,
"spSelectClient Applicant", ds, New String() {"Client", "Applicant" })

ds.Relations.Ad d("Applicants ", ds.Tables("Clie nt").Columns("C lient_ID"),
ds.Tables("Appl icant").Columns ("Client_ID" ))

grdDetails.Data Source = ds.Tables("Clie nt").DefaultVie w

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 4321
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****@discuss ions.microsoft. com> wrote in message
news:DA******** *************** ***********@mic rosoft.com...
My DataGrid is bound to DataSet which contains relationship between two
tables as follows:

SqlHelper.FillD ataset(strConn, CommandType.Sto redProcedure,
"spSelectClient Applicant", ds, New String() {"Client", "Applicant" })

ds.Relations.Ad d("Applicants ", ds.Tables("Clie nt").Columns("C lient_ID"),
ds.Tables("Appl icant").Columns ("Client_ID" ))

grdDetails.Data Source = ds.Tables("Clie nt").DefaultVie w

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("Fi rstName = '" + nameSearch + "'");

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

nyDS.Select("Fi rstName 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.FillD ataset(strConn, CommandType.Sto redProcedure,
"spSelectClient Applicant", ds, New String() {"Client", "Applicant" })

ds.Relations.Ad d("Applicants ", ds.Tables("Clie nt").Columns("C lient_ID"),
ds.Tables("Appl icant").Columns ("Client_ID" ))

grdDetails.Data Source = ds.Tables("Clie nt").DefaultVie w

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("Fi rstName = '" + nameSearch + "'");

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

nyDS.Select("Fi rstName 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.FillD ataset(strConn, CommandType.Sto redProcedure,
"spSelectClient Applicant", ds, New String() {"Client", "Applicant" })

ds.Relations.Ad d("Applicants ", ds.Tables("Clie nt").Columns("C lient_ID"),
ds.Tables("Appl icant").Columns ("Client_ID" ))

grdDetails.Data Source = ds.Tables("Clie nt").DefaultVie w

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
1364
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. The problem I have is that if I clear the all datagrid, and update it to the new array list content, it might happen that I can see my grid...
4
2613
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 that matches that character. If you type another letter within a given amount of time it will be part of the same search so that it will match the...
0
1157
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 is typing based on the type of search ... if (this.txtValue.Text.Length == 0) { this.UnHighlightRow();
2
1075
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. But i want to add a feature so that it saves the search results. for example even after seeing an item the user should be able to still view the...
3
346
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() {"Client", "Applicant"}) ds.Relations.Add("Applicants", ds.Tables("Client").Columns("Client_ID"), ds.Tables("Applicant").Columns("Client_ID")) ...
1
968
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
2056
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 columns. According to this parameter, the dataset and datagrid shows only the columns where the search parameter applies. The code is
0
2067
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 end of this message, but I will start with an overview of the problem. I've made a content management solution for my work with a decently...
0
2712
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, cannot serch by combine 3 table) Example I have the query table below, how do I make the code to seach based on the query from this: SELECT...
0
7609
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8118
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...
1
7666
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...
0
7964
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6278
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...
0
5217
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3651
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...
1
2107
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
1
1208
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.