Hi Guys, I need urgent help needs from all DP members who r expert in ASP & SQL. I‘m using like statement of sql server in asp but value of variable does not retrieve to access a particular record from database. Here is asp: Please check this code and try to sort out this problem… Is there any error in code or there is something missing… Thanks in advance…
response.write(rs("oneofyourfieldnames")) Code (markup): Replace oneofyourfieldnames with one of the fields in the table. Since you're doing a select * I dunno what any of the field names are. Anything?
Try : Set rs=con.execute ("select * from items where model like '%"&tval&"%';") Code (markup): When using LIKE statement you need the percentage signs.
Hi, Your code should work if there is no problem with the 'tval'.Can you just print tval or the whole query "select * from items where model like '"&tval&"' ".Even though we don't use wildcard character '%' with like,it should return a value for an exact match of tval. Regards, Joshy M Raj
Yeah, add the "%" wildcard or otherwise the query will only match tval exactly. Depending on what you're looking for you might want to add it in front and behind...