search button....please help!!!!!!!

shelly121

Member
Joined
Feb 17, 2005
Messages
15
Programming Experience
Beginner
any1 help please? basically iv wrote the code to search for a client name in a database(in access) IN vb.net and this is the code:
Private Sub BtnSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
'search
If txtSearch.Text = "" Then MsgBox("Please type Client Name", MsgBoxStyle.Critical, "Enter Text") : Exit Sub

Dim MYDA As OleDbDataAdapter1 = New OleDbDataAdapter()
Dim MYDS As DataSet = New DataSet()

RS = New ADODB.Recordset()
RS.Open("SELECT * FROM CLIENT WHERE NAME LIKE '" & txtSearch.Text & "%' ", CN, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockOptimistic)
MYDA.Fill(MYDS, RS, "NAME")
DataGrid1.DataSource = MYDS.Tables(0)
End Sub
End Class

but it underlines the "OleDbDataAdapter1" in the Quote:Dim MYDA As OleDbDataAdapter1 =. .......
but i dont know why as that is what my dataAdapter is called??
please help, id be very grateful!!!!!
 

TPM

Well-known member
Joined
Dec 7, 2004
Messages
623
Location
CA
Programming Experience
3-5
As ... is the type not the name. so you'd want to do this:
VB.NET:
Dim MYDA As OleDbDataAdapter = OleDbDataAdapter1

TPM
 

levyuk

Well-known member
Joined
Jun 7, 2004
Messages
313
Location
Wales, UK
Programming Experience
3-5
Make sure you have imported the correct namespace i.e.
VB.NET:
imports system.data.oledb

Put that at the top of your code
 
Top