I am trying to convert a series of VBScripts designed to search an Access database over to searching an SQL2000 database but I am having issues in converting the sql statements. On one, there is a variable being used as part of the query and if I hardcode the value it works but as a variable, it does not. It appears to be a problem with the fact that there is a dash in the value even though it works when hardcoded!
this works after a fashion:
[tt]WHERE (agency.County = N'" & COUNTY & "') AND (AgencyCategory.CATEGORY = N'LR-620')[/tt]
while this does not:
[tt]WHERE (agency.County = N'" & COUNTY & "') AND (AgencyCategory.CATEGORY = N'" & QueryString & "')[/tt]
The error message in the browser is:
Incorrect syntax near 'LR' which seems to indicate that it is having issues with the dash.
I am not sure what the "N" is for - SQL Server Enterprise Manager put it there, but the value "QueryString" is where I am having a problem. The value contains things like "LR-620" for example. Don
don@ctagroup.org
Experienced in HTML, Perl, VBScript, PWS, IIS and Apache. Run OS/2 Warp 4, BeOS v5 and Windows NT (only when I have to!)
this works after a fashion:
[tt]WHERE (agency.County = N'" & COUNTY & "') AND (AgencyCategory.CATEGORY = N'LR-620')[/tt]
while this does not:
[tt]WHERE (agency.County = N'" & COUNTY & "') AND (AgencyCategory.CATEGORY = N'" & QueryString & "')[/tt]
The error message in the browser is:
Incorrect syntax near 'LR' which seems to indicate that it is having issues with the dash.
I am not sure what the "N" is for - SQL Server Enterprise Manager put it there, but the value "QueryString" is where I am having a problem. The value contains things like "LR-620" for example. Don
don@ctagroup.org
Experienced in HTML, Perl, VBScript, PWS, IIS and Apache. Run OS/2 Warp 4, BeOS v5 and Windows NT (only when I have to!)