Help with search and compare of field in dataset

  • Thread starter Thread starter cjh999777
  • Start date Start date
C

cjh999777

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/)
 
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



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/)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top