I am trying to select rows from a database depending on 2 conditions. Tried to use AND but this did not work (see code below). Any suggestions?
cmd.CommandText="select name,perm_id,permid_moth from motherno where hpid = "&txthhidm.Text&" & AND & motherno = "&(txthhidm.Text&*100)+&txtmemno.Text&""
cmd.CommandText="select name,perm_id,permid_moth from motherno where hpid = " & txthhidm.Text & " AND motherno = " & ((txthhidm.Text*100) + txtmemno.Text)
or
YourQuery="select name,perm_id,permid_moth from motherno where hpid = " & txthhidm.Text & " AND motherno = " & ((txthhidm.Text*100) + txtmemno.Text)
msgbox(YourQuery):' only for testing
cmd.CommandText=YourQuery
are you sure that txthhidm and txtmemno are ONLY numeric value???
cmd.CommandText="select name,perm_id,permid_moth from motherno where hpid = "&txthhidm.Text&" & AND & motherno = "&(txthhidm.Text&*100)+&txtmemno.Text&""
here i have correct code:
cmd.CommandText="select name,perm_id,permid_moth from motherno where hpid = '" & txthhidm.Text & "' AND motherno = " & ((txthhidm.Text*100) + txtmemno.Text)
:sign0188: