1

any1 help, basically iv wrote the code to search for a client name in a database(in access) 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

Dim MYDA As OleDbDataAdapter1 =. .......

but i dont know why as that is what my dataAdapter is called??
please help, id be very grateful!!!!!

3
Contributors
4
Replies
5
Views
12 Years
Discussion Span
Last Post by Live_eviL
0

Try adding these imports statements at the top before anything else:

Imports System()
Imports System.Data()
Imports System.Data.Oledb()

If you do not add those imports statements, then when you declare your dataadapter you will have to do something like this:

Dim MYDA As System.Data.Oledb.OleDbDataAdapter1 = New OleDbDataAdapter()

Chester

0

hey thanks CPOPHAM for replyin, i have actually sorted out all of the problems i had, but am grateful fo ya help anyway!!

0

I am glad that you got everything to work out. I just joined the forums.

Chester

0

any1 help, basically iv wrote the code to search for a client name in a database(in access) and this is the code:
but it underlines the "OleDbDataAdapter1" in the but i dont know why as that is what my dataAdapter is called??
please help, id be very grateful!!!!!

try using SQL rather than using multiple codes...
in your adodc properties, find the tab that contains the cmdunknown, i can't remember exactly where that place is...
then check SQl and type:
Select * from (name of table of the database)
ex Select * from emp
this makes the form connected to the database...
then create a textbox which you will input the search word
next, create a search command button...
type this command to be executed...
"Select * from (name of table) where (name of data to be seached eg. REG_NO) like '" & txtSEARCH.Text & "%" & "'"
this makes the program search the word which contains the words or letters that is in the text box...
i hope i helped you...

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.