| | |
Search Button..Plz Help
Please support our VB.NET advertiser: Intel Parallel Studio Home
![]() |
This is pretty easy to do. You can tie the DataGrid to the filter function and pass textbox as a paramter to filter records on the Grid
just paste this code:::
Protected Sub btnchk_name_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnchk_name.Click
Dim str As String = "select ID from table1 where ID = '" & txtid.Text & "'"
Dim con As String = ConfigurationManager.AppSettings("preeconn")
Dim com As New SqlCommand(str, New SqlConnection(con))
com.Connection.Open()
Dim da As New SqlDataAdapter(str, con)
Dim dr As SqlDataReader
dr = com.ExecuteReader 'where sqldatareader ain't run without using
If Not dr.Read() Then
datagrid.datasource=com.executereader()
datagrid.databind()
End If
End Sub
-----------
Protected Sub btnchk_name_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnchk_name.Click
Dim str As String = "select ID from table1 where ID = '" & txtid.Text & "'"
Dim con As String = ConfigurationManager.AppSettings("preeconn")
Dim com As New SqlCommand(str, New SqlConnection(con))
com.Connection.Open()
Dim da As New SqlDataAdapter(str, con)
Dim dr As SqlDataReader
dr = com.ExecuteReader 'where sqldatareader ain't run without using
If Not dr.Read() Then
datagrid.datasource=com.executereader()
datagrid.databind()
End If
End Sub
-----------
•
•
Join Date: Aug 2009
Posts: 2
Reputation:
Solved Threads: 0
is this code applicable to OleDb? because i've tried it Substituting with OleDb, but it seems not to work. here is my code including myDataConnectio. plz help agentely im in a tight position
VB.NET Syntax (Toggle Plain Text)
Protected Sub txtSearch_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtSearch.Click Dim sql As String = "SELECT * FROM new_bug WHERE Status='" & txtStatus2.Text & "'" Dim cmnd As New OleDbCommand(sql, CreateOleDbConnection) Dim da As New OleDbDataAdapter(sql, CreateOleDbConnection) Dim dr As OleDbDataReader = cmnd.ExecuteReader If Not dr.Read() Then GridBugList.DataSource = cmnd.ExecuteReader() GridBugList.DataBind() End If End Sub Public Function CreateOleDbConnection() As OleDbConnection Dim myConnString As String = "Provider=Microsoft.Jet.OleDb.4.0;Data Source=" + Server.MapPath("~/App_Data/bug_base.mdb") Dim myConnection As New OleDbConnection(myConnString) myConnection.Open() Return myConnection End Function
Last edited by John A; Aug 26th, 2009 at 10:11 pm. Reason: added code tags
![]() |
Similar Threads
- problem clicking on button (Perl)
- Could somebody write code for my project plz... (Visual Basic 4 / 5 / 6)
- Search code ... (Visual Basic 4 / 5 / 6)
- search record using search button from database (ASP)
- Where, oh where has my search button gone? (DaniWeb Community Feedback)
- help please cannot use search button on ie6 (Web Browsers)
Other Threads in the VB.NET Forum
- Previous Thread: Access Database + Soundex(Sound like Query)
- Next Thread: Calender extender
| Thread Tools | Search this Thread |
"crystal .net .net2005 30minutes 2005 2008 access arithmetic array assignment basic binary bing box button buttons center check code combobox component connectionstring convert crystalreport data database databasesearch datagrid datagridview design dissertation dissertations dissertationthesis dosconsolevb.net dropdownlist editvb.net excel file-dialog firewall folder ftp google hardcopy image images isnumericfuntioncall listview login math memory mobile ms mssqlbackend mysql navigate net networking opacity output peertopeervideostreaming picturebox picturebox1 port print printpreview problemwithinstallation project record reports" save savedialog searchbox serial soap sorting string tcp temp text textbox timer toolbox trim updown upload useraccounts usercontrol vb vb.net vb.netcode vb.nettoolboxvisualbasic2008sidebar vb2008 vbnet view visual visualbasic visualbasic.net visualstudio web wpf





