DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   ASP.NET (http://www.daniweb.com/forums/forum18.html)
-   -   Search record from SQLDatabase (http://www.daniweb.com/forums/thread74660.html)

june_bunga Apr 8th, 2007 11:57 pm
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

ManicCW Apr 13th, 2007 3:28 am
Re: Search record from SQLDatabase
 
Use ddl.SelectedValue.ToString

june_bunga Apr 13th, 2007 5:20 am
Re: Search record from SQLDatabase
 
Quote:

Originally Posted by ManicCW (Post 344197)
Use ddl.SelectedValue.ToString

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

ManicCW Apr 13th, 2007 7:29 am
Re: Search record from SQLDatabase
 
Please paste your exception here.


All times are GMT -4. The time now is 1:02 am.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC