How to fill datagridview from code behind

ez416

Member
Joined
Apr 17, 2007
Messages
9
Programming Experience
1-3
i have this code in connecting to the database

Dim CHKcmd As New SqlCommand("SELECT * FROM testTB", SQLme)
SQLme.Open()
Dim CHKval As SqlDataReader = CHKcmd.ExecuteReader()

how can I bind my connection to the datagridview control.

because in asp.net, it is just like this

Dim CHKcmd As New SqlCommand("SELECT * FROM testTB", SQLme)
SQLme.Open()
Dim CHKval As SqlDataReader = CHKcmd.ExecuteReader()

gridview1.datasource = chkcmd.executereader()
gridview1.bind

if you have any alternative solution, please share it. thanks!
 
click the DW2 link in my signature, read the Simple Application tutorial, then sections on Fetching and also Displaying Data In Your App
 
Back
Top