how to bind sql data to a label in a dialog result vb.net -
i working in vb.net windows form applications, backed sql server. trying load dialog result , need auto load label dialog result. however, whenever try , bind sql results label getting error. have done before data in dgv loaded sql query 1 giving me issues. error comes when attempt load variable "datareader" "f.labelshear.text = datareader."
private sub button1_click(sender object, e eventargs) handles m01.click dim dr dialogresult dim f new cellcontent using conn1 new sqlconnection(connstring) conn1.open() using comm1 sqlcommand = new sqlcommand("select shear production.dbo.tblfabwiplog fabwipid = 1", conn1) dim datareader sqldatareader = comm1.executereader datareader.tostring() f.labelshear.text = datareader end using end using end sub
i doubt neither first code , second code work. after declaring datareader had code datareader.read()
later on f.labelshear.text = datareader(0).tostring
binding work.
Comments
Post a Comment