Search Button..Plz Help

Please support our VB.NET advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Sep 2007
Posts: 72
Reputation: geetajlo is an unknown quantity at this point 
Solved Threads: 0
geetajlo geetajlo is offline Offline
Junior Poster in Training

Search Button..Plz Help

 
0
  #1
Oct 16th, 2007
hi can anyone help me . when the user enter the name in a textbox and click the search button, the output should be display in the datagrid... Help plz have to submit my project in 8 days
Reply With Quote Quick reply to this message  
Join Date: Dec 2006
Posts: 645
Reputation: binoj_daniel is an unknown quantity at this point 
Solved Threads: 17
binoj_daniel's Avatar
binoj_daniel binoj_daniel is offline Offline
DaniWeb Expert

Re: Search Button..Plz Help

 
0
  #2
Oct 16th, 2007
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
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 82
Reputation: preetham.saroja is an unknown quantity at this point 
Solved Threads: 1
preetham.saroja's Avatar
preetham.saroja preetham.saroja is offline Offline
Junior Poster in Training

Re: Search Button..Plz Help

 
0
  #3
Oct 18th, 2007
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
-----------
Reply With Quote Quick reply to this message  
Join Date: Aug 2009
Posts: 2
Reputation: nduduzo is an unknown quantity at this point 
Solved Threads: 0
nduduzo nduduzo is offline Offline
Newbie Poster

Re: Search Button..Plz Help

 
0
  #4
Aug 26th, 2009
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

  1. Protected Sub txtSearch_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtSearch.Click
  2. Dim sql As String = "SELECT * FROM new_bug WHERE Status='" & txtStatus2.Text & "'"
  3. Dim cmnd As New OleDbCommand(sql, CreateOleDbConnection)
  4. Dim da As New OleDbDataAdapter(sql, CreateOleDbConnection)
  5. Dim dr As OleDbDataReader = cmnd.ExecuteReader
  6. If Not dr.Read() Then
  7. GridBugList.DataSource = cmnd.ExecuteReader()
  8. GridBugList.DataBind()
  9. End If
  10. End Sub
  11.  
  12. Public Function CreateOleDbConnection() As OleDbConnection
  13. Dim myConnString As String = "Provider=Microsoft.Jet.OleDb.4.0;Data Source=" + Server.MapPath("~/App_Data/bug_base.mdb")
  14. Dim myConnection As New OleDbConnection(myConnString)
  15. myConnection.Open()
  16. Return myConnection
  17. End Function
Last edited by John A; Aug 26th, 2009 at 10:11 pm. Reason: added code tags
Reply With Quote Quick reply to this message  
Reply

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




Views: 3630 | Replies: 3
Thread Tools Search this Thread



Tag cloud for VB.NET
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC