473,322 Members | 1,425 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,322 software developers and data experts.

Help with search and compare of field in dataset

Hi,

I am new to using databases in vb.net and i have created a accessdatabase called employee it has a key field called employeeID. Ihave gotton as far as creating the dataconnection, thedataadapter and the dataset and I have bound it to a datagridjust so that i can see that the data is there and it is workingcorrectly. My problem is that I cant figure out how to searchthough the dataset and retrieve the record that matches anemployee id that is enterd into a text box. I could really usean explation of how this works and some example code. Any helpwill be gratly appreciate as I have been trying to do this for24 hrs straight now.

Thanks in advance
Chris
User submitted from AEWNET (http://www.aewnet.com/)
Nov 21 '05 #1
3 1378
How you go about it depends on what you want to do with it when your done.

Dim DT as DataTable
Dim DR() as DataRow
DT = Dataset1.Tables(0)
DR = DT.Select("XXX = '123'") 'Now DR has an array of datarows that meat the
criteria

or

Dim DT as DataTable
Dim DR() as DataRow
DT = Dataset1.Tables(0)
DT.DefaultView.RowFilter = "XXX = '123'"
DataGrid1.Datasource = DT.DefaultView 'Now your datagrid only shows the rows
where the criteria is met.

Hope this helps some
Chris

"cjh999777" <cjh999777@aew_nospam.com> wrote in message
news:el**************@TK2MSFTNGP14.phx.gbl...
Hi,

I am new to using databases in vb.net and i have created a access database
called employee it has a key field called employeeID. I have gotton as far
as creating the dataconnection, the dataadapter and the dataset and I have
bound it to a datagrid just so that i can see that the data is there and it
is working correctly. My problem is that I cant figure out how to search
though the dataset and retrieve the record that matches an employee id that
is enterd into a text box. I could really use an explation of how this works
and some example code. Any help will be gratly appreciate as I have been
trying to do this for 24 hrs straight now.

Thanks in advance
Chris
User submitted from AEWNET (http://www.aewnet.com/)
Nov 21 '05 #2
Start here:

http://msdn.microsoft.com/library/de...ridatasets.asp

"cjh999777" wrote:
Hi,

I am new to using databases in vb.net and i have created a access database called employee it has a key field called employeeID. I have gotton as far as creating the dataconnection, the dataadapter and the dataset and I have bound it to a datagrid just so that i can see that the data is there and it is working correctly. My problem is that I cant figure out how to search though the dataset and retrieve the record that matches an employee id that is enterd into a text box. I could really use an explation of how this works and some example code. Any help will be gratly appreciate as I have been trying to do this for 24 hrs straight now.

Thanks in advance
Chris
User submitted from AEWNET (http://www.aewnet.com/)

Nov 21 '05 #3
Chris,

The dataview.find is in my opinon the most easy one for what you ask.

http://msdn.microsoft.com/library/de...sfindtopic.asp

a sample is in this page

I hope this helps?

Cor
Nov 21 '05 #4

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

Similar topics

1
by: Melissa Kay Beeline | last post by:
OK, here's the sitch : we have an access control system at work that registers ever entry/exit of every employee. I recently made some queries in Access so the ppl in HR could make reports (who...
0
by: news.microsoft.com | last post by:
first i apologize for the potential crosspost. this group gets far more traffic. now that i have that out of the way... ;) apparently using AutoGenerated Commands on Command objects does not work...
1
by: Mark | last post by:
by m.r.davies I have 2 tables on seperate Db's (and servers) I want to use a datareader on the first table to pick the booking ref, and then use that booking ref to query the 2nd DB when i have...
5
by: Ron S | last post by:
After days of searching I finally an example that would work with my application, the only problem is after entering all of the code it is not working. Would someone be kind enough to take a look at...
9
by: pic078 via AccessMonster.com | last post by:
I need serious help - I have a frontend/backend Access database (2 MDE Files) that remains stuck in task manager after exiting the application - you can't reopen database after exiting as a result...
1
by: ebernedo | last post by:
Hey guys, I have two main questions First off (pictures are kind of blurry) I have this table http://i197.photobucket.com/albums/aa109/ebernedo/DiscTable.jpg And thats my database I use my...
8
by: Miro | last post by:
Hi sorry for the quick question. I am on the right track but just cant seem to find what to search for in my books / online for the answer I am looking for. I have created a dataset within my...
1
by: =?Utf-8?B?RGFuIFNoZXBoZXJk?= | last post by:
I am playing around trying to learn how to manipulate data in VB 2005. I have code set to open up two db connections and pull in select data. Now what I need to do is loop through table 1, field...
4
by: mattehz | last post by:
Hey there, I am trying to upload old source files and came across these errors: Warning: Invalid argument supplied for foreach() in /home/mattehz/public_html/acssr/trunk/inc_html.php on line 59...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work

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.