Search record from SQLDatabase

Please support our ASP.NET advertiser: $4.95 a Month - ASP.NET Web Hosting – Click Here!
Reply

Join Date: Apr 2007
Posts: 3
Reputation: june_bunga is an unknown quantity at this point 
Solved Threads: 0
june_bunga june_bunga is offline Offline
Newbie Poster

Search record from SQLDatabase

 
0
  #1
Apr 8th, 2007
Private Sub btnsearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnsearch.Click
Try
txtmsg.Text = ""
OleDbDataAdapter1 = New OleDbDataAdapter("select * from phbook where name like '" & ddl.SelectedItem.Text & "%'", OleDbConnection1)
OleDbDataAdapter1.Fill(DataSet21, "phbook")
OleDbConnection1.Open()
Dim com As New OleDbCommand
com.Connection = OleDbConnection1
com.CommandText = "select * from phbook"
dg1.DataBind()
Catch ex As Exception
txtmsg.Text = ex.ToString
OleDbConnection1.Close()
End Try
End Sub


i was tried this code to my application for search record form database.But got syntax error on ddl.selecteditem.text .

can anyone teach me how to make this code usefull to my application.
tq
Reply With Quote Quick reply to this message  
Join Date: Nov 2005
Posts: 95
Reputation: ManicCW is an unknown quantity at this point 
Solved Threads: 11
ManicCW's Avatar
ManicCW ManicCW is offline Offline
Junior Poster in Training

Re: Search record from SQLDatabase

 
0
  #2
Apr 13th, 2007
Use ddl.SelectedValue.ToString
Reply With Quote Quick reply to this message  
Join Date: Apr 2007
Posts: 3
Reputation: june_bunga is an unknown quantity at this point 
Solved Threads: 0
june_bunga june_bunga is offline Offline
Newbie Poster

Re: Search record from SQLDatabase

 
0
  #3
Apr 13th, 2007
Originally Posted by ManicCW View Post
Use ddl.SelectedValue.ToString
still doesn't works. can u paste here what u have done.
Reply With Quote Quick reply to this message  
Join Date: Nov 2005
Posts: 95
Reputation: ManicCW is an unknown quantity at this point 
Solved Threads: 11
ManicCW's Avatar
ManicCW ManicCW is offline Offline
Junior Poster in Training

Re: Search record from SQLDatabase

 
0
  #4
Apr 13th, 2007
Please paste your exception here.
Reply With Quote Quick reply to this message  
Reply

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


Thread Tools Search this Thread



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

©2003 - 2009 DaniWeb® LLC