winforms - Vb.net .net Framework 1.0 how to access data from database and show in text box -
i using .net framework 1.0 in vb.net win form, question how can access data database , show particular column , row in textbox. show data in gridview want show data in lable , text box.
public dim connectionstring new sqlconnection( "data source=.;initial catalog=wtfimaga;integrated security=true" ) public sqldataadapter new sqldataadapter( "select * wu.dbo.students",connectionstring ) public sqldataset new dataset public sqlcommandbuil new sqlcommandbuilder(sqldataadapter)
and onclick can show data load on gridview want show student name on label
private sub button1_click(sender object, e eventargs) handles button1.click sqldataset.clear() datagridview1.datasource = sqldataset datagridview1.datasource = nothing sqldataadapter.fill(sqldataset ,"students") datagridview1.datasource = sqldataset.tables("students") textbox1.text = sqldataadapter.fill(sqldataset,"students.studentid") end sub
private sub button1_click(sender object, e eventargs) handles button1.click sqldataset.clear() datagridview1.datasource = sqldataset datagridview1.datasource = nothing sqldataadapter.fill(sqldataset ,"students") datagridview1.datasource = sqldataset.tables("students") textbox1.text = sqldataset.tables("students").rows(0).item("studentid") end sub
show student id 1 of rows in dataset
Comments
Post a Comment