Click here to Skip to main content
15,867,704 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
anybody can say me to how to fill datagridview in vb.net i'm using ado.net in vb.net 2010
Posted

1 solution

The easiest way is:
VB
Using con As New SqlConnection(strConnect)
	con.Open()
	Using da As New SqlDataAdapter("SELECT MyColumn1, MyColumn2 FROM myTable WHERE mySearchColumn = @SEARCH", con)
		da.SelectCommand.Parameters.AddWithValue("@SEARCH", myTextBox.Text)
		Dim dt As New DataTable()
		da.Fill(dt)
		myDataGridView.DataSource = dt
	End Using
End Using
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900