943,614 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Unsolved
  • Views: 5407
  • VB.NET RSS
Mar 1st, 2005
1

search code not working!!!

Expand Post »
any1 help, basically iv wrote the code to search for a client name in a database(in access) and this is the code:
Quote ...
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!!!!!
Last edited by shelly121; Mar 1st, 2005 at 10:49 am. Reason: mistype
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
shelly121 is offline Offline
17 posts
since Feb 2005
Mar 14th, 2005
0

Re: search code not working!!!

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
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
cpopham is offline Offline
65 posts
since Mar 2005
Mar 15th, 2005
0

Re: search code not working!!!

hey thanks CPOPHAM for replyin, i have actually sorted out all of the problems i had, but am grateful fo ya help anyway!!
Reputation Points: 10
Solved Threads: 0
Newbie Poster
shelly121 is offline Offline
17 posts
since Feb 2005
Mar 15th, 2005
0

Re: search code not working!!!

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

Chester
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
cpopham is offline Offline
65 posts
since Mar 2005
Mar 2nd, 2009
0

Re: search code not working!!!

Click to Expand / Collapse  Quote originally posted by shelly121 ...
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...
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Live_eviL is offline Offline
1 posts
since Mar 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: Plese Help me in Threading
Next Thread in VB.NET Forum Timeline: Combobox Focus





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC