Wednesday, March 7, 2012

MS Sql 2005 Master DB sysprocess with ASP

I am having issue trying to obtain data from a query to MS SQL 2005 master database using a ASP to view the information. When I use management studio and run this query, I get the correct result.

Code: ( text )

  1. select hostname, count(*) from master.sys.sysprocesses group by hostname

When trying to implement this to write out to a asp page, the result is the machine that is hitting the DB and nothing more. This works for a MS SQL 2000 but why doesn't it work for 2005. Here is the ado snippt I am using to connect to the DB using DSN.

Code: ( text )

  1. Set objConn = server.CreateObject("ADODB.Connection")

  2. objConn.Open "dbserver", "user", "password"

  3. strSQL = "select hostname, count(*) as ""Connection"" from master..sysprocesses (nolock) group by hostname order by ""Connection"" desc"

  4. Set sqlData = objConn.Execute(strSQL)

What error do you get?
It occurs on objConn.Open, or on objConn.Execute?|||The odd thing is, I am not getting any Errors.
The page works but it doesn't show the correct information.
What it shows is the web machine that is accessing the sql 2005 machine.|||

Quote:

Originally Posted by rvl1980

The odd thing is, I am not getting any Errors.
The page works but it doesn't show the correct information.
What it shows is the web machine that is accessing the sql 2005 machine.


This is what I get from 2000 and 2005 sql from my asp.

From MS SQL 2000 using asp to display
Host Num of Connection(s)
Server123 118
WSX0160 90

From MS SQL 2005 using asp to display
Host Num of Connection(s)
TRACKING 1|||I guess there no help with this?

No comments:

Post a Comment