vb.net - Filling values in DataGridView -
i want display result of select query in datagridview
clause in query. condition specified in label's value. i.e
select * hospital_details location_name= '" & label6.text & "'"
following code
public sub fill() try createconnection() da = new sqldataadapter dim c string c = label6.text comm.commandtext = "select * hospital_details location_name= '" & label6.text & "'" da.selectcommand = comm da.fill(ds, "hospital_details") datagridview2.datasource = ds.tables(0) datagridview2.datamember = "hospital_details" datagridview2.readonly = true catch ex exception msgbox("error: " & ex.source & ": " & ex.message, msgboxstyle.okonly, "connection error !!") end try end sub
but showing error : nullexception
you can load data sql server , follow link http://mssqlguid.blogspot.in/2013/07/how-to-load-data-into-datagridview-from.html
Comments
Post a Comment