Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 is this query right

Author  Topic 

amitbadgi
Starting Member

29 Posts

Posted - 2005-09-07 : 14:41:50
Hi , I am using this query in an asp.net project, can u let me know if its right as its giving me an error (unspecified error)

rs_locationcount.Source = "SELECT count(*) AS lcount FROM tblLKP_Location WHERE zone = " & Replace (rs_locationcount__MMColParam, "'", "''") & "" '" and active = 'Y'"

zone is defined as a number in an access database, and
rs_locationcount__MMColParam is defined as follows,

Dim rs_locationcount__MMColParam
rs_locationcount__MMColParam = "1"
If (Request.QueryString("id") <> "") Then
rs_locationcount__MMColParam = Request.QueryString("id")
End If

Id is defined as autonumber in teh access database.

Thanks in advance

SamC
White Water Yakist

3467 Posts

Posted - 2005-09-07 : 16:31:55
Someone may eagle eye the syntax error, but I like to write out the final querystring as an HTML comment. I do it so often, I wrote a subroutine to timestamp the commented HTML as an aid in tracking the time it takes to render the page...

Something like:

CALL HTMLComment ("Your string here")

Results in output like:

<!-- 00NNNN ms Your string here -->

handy for debugging this stuff. Adding vbCrLf in front of the comment makes it easier to find.

In your case, code the sub, and call it using...

CALL HTMLComment (rs_locationcournt.source)

You could then copy / paste the resulting querystring into SQL Query Analyzer to quickly find syntax problems. (Assuming it's a syntax problem.)
Go to Top of Page
   

- Advertisement -