Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Find Method

Status
Not open for further replies.

dedo8816

Programmer
Oct 25, 2006
94
GB
Hi again,

Im using the below code to run a search in a form against an Access Database.

The string to find comes from a textbox called TxSearch

Private Sub CmdSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CmdSearch.Click
Dim dr As DataRow
Dim dt As DataTable
dr = dt.Rows.Find("KeyToFind")
If dr Is Nothing Then
MsgBox("Not Found")
Else
Me.TxSearch.Text = dr.Item("No").ToString
End If

End Sub

How do i assign dt a value? I got this code from the MSDN online help. Im still a novice at this and am still trying to learn how to do this. This probably seems like the stupidest way of doing what im trying to do. Please help

Thanks in advance

D
 
Assign dt a value? dt being your DataTable?

First, you need to make an OleDBConnection to your Access database.

Next, you need to use an OleDBCommand with a OleDBDataAdapter to fill a new DataTable with data.

Then, you can set your dt variable to the DataTable you've filled.

 
Why doesn't the MSDN reference guide explain that?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top