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

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

android - Keyboard hides my half of edit-text and button below it even in scroll view -

css - Make div keyboard-scrollable in jQuery Mobile? -