Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I query a dataset to populate a search form

Status
Not open for further replies.

sclary34

MIS
Jan 28, 2002
8
US
I am creating a form to search a SQL Server database and return hits. I want to make a dataset of the table in SQL Server and then run select queries from there. What is the best way to do this? This is how I'm populating the dataset.



Private Sub btnSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSearch.Click

Dim strSelect As String = "SELECT * FROM tblMail"
Dim dscmd As New SqlDataAdapter(strSelect, gConnection)


Dim dsMail As New DataSet()
dscmd.Fill(dsMail, "tblMail")

End Sub
 
That means you have now filled the dataset, the next step is to use the "DataSource" method to bind an appropriate control to that data set.

Example:

DataGrid1.DataSource = dscmd

Enjoy!! "Life is full of learning, and then there is wisdom"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top