vb.net - unable to get that data from sql to display in textbox what's wrong with the code? -
i want input data textbox1 (ex: nsb1000-pcp) , when click textbox2 want display corresponding value of pcp pentax.
unable data sql display in textbox2.
what's wrong code?
(pcp = abbrev; pentax = comp)
dim conn sqlconnection dim adapter new sqldataadapter dim connecting string dim reader sqldatareader connecting = "data source = erik\sqlexpress; integrated security = true; database = nsb1" conn = new sqlconnection(connecting) dim text1 string = textbox1.text dim words() string dim separator() string = {"-"} words = text1.split(separator, stringsplitoptions.removeemptyentries) try conn.open() dim query string = words(1) query = "select comp list abbrev = '" & textbox1.text & "' " command = new sqlcommand(query, conn) reader = command.executereader dim dt new datatable while reader.read textbox2.text = reader("comp") end while conn.close() catch ex exception end try
Comments
Post a Comment