954,593 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Search record from SQLDatabase

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

june_bunga
Newbie Poster
3 posts since Apr 2007
Reputation Points: 10
Solved Threads: 0
 

Use ddl.SelectedValue.ToString

ManicCW
Junior Poster in Training
95 posts since Nov 2005
Reputation Points: 13
Solved Threads: 11
 
Use ddl.SelectedValue.ToString



still doesn't works. can u paste here what u have done.

june_bunga
Newbie Poster
3 posts since Apr 2007
Reputation Points: 10
Solved Threads: 0
 

Please paste your exception here.

ManicCW
Junior Poster in Training
95 posts since Nov 2005
Reputation Points: 13
Solved Threads: 11
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You