ASP using VB Script and SQL Server 6.5

Hi Experts

I wrote a sql in my asp page

querystring = "select subr_acct_id, subr_acct_nm from subr_acct where substr(subr_acct_nm,1,1)= substr(Upper(search),1,1)"
adors.Open querystring,"dsn=vneti;database=subscription;uid=vnetix;pwd=vnetix"

when I execute it is not able to recognise substr funtion. It returns an error saying

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC SQL Server Driver][SQL Server]'substr' is not a recognized built-in function name.

Can you help me out.
Thx
-Vneti
vnetiAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

vnetiAuthor Commented:
while downloading SQL Server 6.5 I had received an error saying
"ODBC COULD NOT BE INSTALLED, COULD NOT LOAD ODBCCP32.DLL, THE ODBC INSTALLER. PLEASE INSTALL IT FROM CD"
I am not able to find this DLL. Does this any way effect the error which I am getting.
0
jhanceCommented:
No, the problem with your substr is that it is inside the quotes of the querystring and the function (which needs to be executed by the ASP interpreter) is getting passed as part of the SQL and is not recognized by the SQL server.  Try it like this (or similar if I make a typo):

querystring = "select subr_acct_id, subr_acct_nm from subr_acct where " & substr(subr_acct_nm,1,1) & "=" & substr(Upper(search),1,1)

This way you build the querystring up from a collection of static strings in "" and the results returned from the substr functions.


0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Hardware

From novice to tech pro — start learning today.