| | |
Search record from SQLDatabase
Please support our ASP.NET advertiser: $4.95 a Month - ASP.NET Web Hosting – Click Here!
![]() |
•
•
Join Date: Apr 2007
Posts: 3
Reputation:
Solved Threads: 0
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
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
![]() |
Similar Threads
- Search records in a database (ASP.NET)
- How to Search record from the Sql Server Database (ASP.NET)
- Search facility for a drop down box (MySQL)
- search record using search button from database (ASP)
Other Threads in the ASP.NET Forum
- Previous Thread: Server Error in '/' Application
- Next Thread: Upload file
| Thread Tools | Search this Thread |
.net 2.0 3.5 activexcontrol advice ajax alltypeofvideos appliances asp asp.net bc30451 beginner bottomasp.net browser businesslogiclayer c# c#gridviewcolumn cac checkbox class commonfunctions compatible confirmationcodegeneration content contenttype countryselector courier css database datagrid datagridview datagridviewcheckbox datalist deployment development dgv dropdownlist dropdownmenu dynamic edit embeddingactivexcontrol fileuploader fill findcontrol flash flv formatdecimal forms formview gridview gudi homeedition iframe iis javascript jquery menu microsoft mono mssql multistepregistration nameisnotdeclared novell objects panelmasterpagebuttoncontrols problem redirect registration relationaldatabases rotatepage schoolproject security serializesmo.table sessionvariables silverlight smartcard smoobjects sql sqlserver2005 ssl suse textbox tracking treeview unauthorized validatedate validation vb.net video virtualdirectory vista visual-studio visualstudio vs2008 web webarchitecture webdevelopemnt webdevelopment webservice youareanotmemberofthedebuggerusers





