database - Retrieve data from Db set by combobox and display to textbox -
this code
s2="select notes atotalno =" + combobox1.selecteditem +"" dim cmd oledbcommand=new oledbcommand(s2,myconnection1) cmd.commandtext=s2 textbox1.text=convert.toint32(cmd.executescalar()).tostring()
and getting following error:-
erorr: data type mismatch in criteria expression
apply tostring()
on selecteditem , why convert result set integer, if want show in textbox?
try this,
s2 = "select notes atotalno = "& combobox1.selecteditem.tostring() &"" dim cmd oledbcommand = new oledbcommand(s2, myconnection1) cmd.commandtext = s2 textbox1.text = "" & cmd.executescalar()
here resultset concatenated empty string make whole string.
if column atotalno
of type varchar decorate selecteditem value single quotes. like,
s2 = "select notes atotalno = '"& combobox1.selecteditem.tostring() &"'"
hope helps thanks.
Comments
Post a Comment