how can i assign values that are not found in my table during select statement from table ?
September 11th, 2009 | by admin |i am using vb.net and sql server 2000
create table mytable(country varchar(20),city varchar(20))
insert into mytable values(’Ethiopia’,'Mekelle)
insert into mytable values((’USA’,'newyork’)
insert into mytable values(’England’,'Chelsea’)
dim str as string
str=select * from mytable where country=’ "&txtcountry.text&" ‘
then when I enter country name from the textbox
let me enter, Ethiopia, USA, England, it works fine becuase these values are available in my table but when i try to enter values that don’t exists on my table, i want to transfer it to other textbox or to dispaly as error message,
let me try to enter, kenya,then since ‘Kenya’ is not my table ,i will expect error message so how can i do this?
Select with ‘Kenya’ will return an empty recordset. You should check whether returned recordset has both EOF and BOF properties set to true. If so, there is no match and you can put in the other text box whatever you want.
One Response to “how can i assign values that are not found in my table during select statement from table ?”
By BataV on Sep 11, 2009 | Reply
Select with ‘Kenya’ will return an empty recordset. You should check whether returned recordset has both EOF and BOF properties set to true. If so, there is no match and you can put in the other text box whatever you want.
References :