sql server - Error occur while there is no row at position 0 -


imports system.data.sqlclient  imports system.data  public class window1      private sub btn_click(sender object, e routedeventargs) handles btn.click         dim cmd sqlcommand = new sqlcommand("select * tencmpc1 qnumber='1';", new sqlconnection("server=(localdb)\projects;database=master;uid=sa;pwd=12345;"))           try              cmd.connection.open()             dim adp new sqldataadapter(cmd)              dim dt new datatable()             adp.fill(dt)               txt1.text = dt.rows(0)("qnumber").tostring()              txt2.text = dt.rows(0)("topic").tostring()             txt3.text = dt.rows(0)("umcq").tostring()             txt4.text = dt.rows(0)("usq").tostring()             txt5.text = dt.rows(0)("ulq").tostring()             txt6.text = dt.rows(0)("emcq").tostring()             txt7.text = dt.rows(0)("esq").tostring()             txt8.text = dt.rows(0)("elq").tostring()             txt9.text = dt.rows(0)("pdate").tostring()                cmd.executenonquery()         catch ex exception             txt10.text = ex.message         end try      end sub end class 

above code vb file. have wpf form. i'm doing wrong please guide me?


Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -