borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (Taking out Limitation of Image Combo)Next Topic (change mdichild on runtime) New Topic New Poll Post Reply
AndreaVB Forum : VB General : SQL SERVER 2000: SQL STMT SELECT LIKE CHR() ERROR
Poster Message
VYX
Level: Professor


Registered: 16-12-2005
Posts: 70

icon SQL SERVER 2000: SQL STMT SELECT LIKE CHR() ERROR

Hi guys !!

Previously i used ms access as my database and now i shift to sql server 2000. It seems the codes of the sql statement in ms access were both similar, but when i try to create search record using my code that works in ms access  it appears runtime error on my screen...

code:

  select * from tbl where code like '"& txtsrch.text &"' & chr(37)

        
Runtime Error:

           ''chr is not a recognized function name''

The code is for single table only how if i have a multiple table to be relate using some sql stmt in sql server 2000 like select,delete and so on...

Anybody can help me please.. and also if anybody know some problems that i will encounter as i go on using sql server 2000 may i ask that if possible please post it here.

Thanks a lot..

vyx


[Edited by VYX on 23-09-2006 at 08:25 AM GMT]

22-09-2006 at 01:30 PM
View Profile Send Email to User Show All Posts | Quote Reply
GeoffS
Level: VB Lord


Registered: 29-09-2004
Posts: 536
icon Re: SQL SERVER 2000: SQL STMT SELECT LIKE CHR() ERROR

Hi,
The Error description indicates that the "SELECT" statement to SQL Server includes the actual string "chr(37)" which is why SQL Server cannot parse the statement as "chr" is a VB Function and is therefore not recognised. Get the returned character into the SQL Statement string before running the Command.

Dim strSQL As String

strSQL = "SELECT tbl.* FROM tbl WHERE ((tbl.code) LIKE '" & txtsrch.text & "')" & chr(37)

rst = cmd.Execute strSQL



____________________________
multi-tasking - the ability to hang more than one app. at the same time.

23-09-2006 at 11:53 AM
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : VB General : SQL SERVER 2000: SQL STMT SELECT LIKE CHR() ERROR
Previous Topic (Taking out Limitation of Image Combo)Next Topic (change mdichild on runtime) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder