search code not working!!!

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Feb 2005
Posts: 17
Reputation: shelly121 is an unknown quantity at this point 
Solved Threads: 0
shelly121 shelly121 is offline Offline
Newbie Poster

search code not working!!!

 
0
  #1
Mar 1st, 2005
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!!!!!
Last edited by shelly121; Mar 1st, 2005 at 10:49 am. Reason: mistype
Reply With Quote Quick reply to this message  
Join Date: Mar 2005
Posts: 65
Reputation: cpopham is an unknown quantity at this point 
Solved Threads: 0
cpopham cpopham is offline Offline
Junior Poster in Training

Re: search code not working!!!

 
0
  #2
Mar 14th, 2005
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
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 17
Reputation: shelly121 is an unknown quantity at this point 
Solved Threads: 0
shelly121 shelly121 is offline Offline
Newbie Poster

Re: search code not working!!!

 
0
  #3
Mar 15th, 2005
hey thanks CPOPHAM for replyin, i have actually sorted out all of the problems i had, but am grateful fo ya help anyway!!
Reply With Quote Quick reply to this message  
Join Date: Mar 2005
Posts: 65
Reputation: cpopham is an unknown quantity at this point 
Solved Threads: 0
cpopham cpopham is offline Offline
Junior Poster in Training

Re: search code not working!!!

 
0
  #4
Mar 15th, 2005
I am glad that you got everything to work out. I just joined the forums.

Chester
Reply With Quote Quick reply to this message  
Join Date: Mar 2009
Posts: 1
Reputation: Live_eviL is an unknown quantity at this point 
Solved Threads: 0
Live_eviL Live_eviL is offline Offline
Newbie Poster

Re: search code not working!!!

 
0
  #5
Mar 2nd, 2009
Originally Posted by shelly121 View Post
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...
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the VB.NET Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC