vb.net - How do i populate a Sql database in a Visual Basic 2010 DataGridview? -
i'm using code below populate data server tables vb application. unfortunately cannot populate data, displays test table entered during vb database creation. ideas appreciated. thanks!
open student locator
dim sql sqlcommand = new sqlcommand("select * database.dbo.table", cnn) dim stud_data dataset = new dataset() dim dataadapter1 sqldataadapter = new sqldataadapter() dataadapter1.selectcommand = sql dataadapter1.fill(stud_data, "student") studentlistdatagridview.datasource = stud_data
your stud_data dataset, need tell datagridview datasource table bind to.
try;
studentlistdatagridview.datasource = stud_data.tables[0]
Comments
Post a Comment