If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Moved servers: Now my Aggregate functions won't work

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-31-08, 11:08
SEAQUIL SEAQUIL is offline
Registered User
 
Join Date: Mar 2008
Posts: 6
Question Moved servers: Now my Aggregate functions won't work

Okay, this is weird!

I had a (ASP - VB Script) web application sitting on a Windows 2000 box with SQL Server 2005 as the backend.

Last month, we moved to a Windows 2003 machine, all the code stayed the same, as well as the backend.

The PROBLEM: Aggregate sql statements are not executing!

SELECT Sum(CarCost) as TheCost from Automotive;

This query returns no record. When I run it directly through the backend on SQL Server 2005, I get the amount I'm looking for.

So then I started doing more testing....Count(*), Sum(), Avg(), etc...none of them work...but a standard select, does.

Any clue folks?
Reply With Quote
  #2 (permalink)  
Old 03-31-08, 11:46
gvee gvee is offline
www.gvee.co.uk
 
Join Date: Jan 2007
Location: UK
Posts: 10,156
Moving this to the ASP topic as it doesn't appear to be an SQL Server problem.


...Can you post an example of some offending ASP code?
__________________
George
Twitter | Blog
Reply With Quote
  #3 (permalink)  
Old 03-31-08, 11:55
SEAQUIL SEAQUIL is offline
Registered User
 
Join Date: Mar 2008
Posts: 6
thanks for the note:

here she blows:

<!-- #INCLUDE FILE="../../../global.asp" -->
<!-- #INCLUDE FILE="Utilities.asp" -->

<%

Server.ScriptTimeOut = 60 * 20 '20 minutes
connIPO.open provIPO

Insert

Sub Insert()

dim sql
sql = "SELECT fType FROM tPortTypes WHERE fPortID = 7 AND tPortTypes.fPortTypeID <> 496"

Response.Write("<BR><BR>" & sql & "<BR><BR>")

Set rsi = Server.CreateObject("ADODB.Recordset")
On Error Resume Next

rsi.open sql, connIPO, 3, 3
intRows = rsi.RecordCount
response.write("<b><font color=blue>NO ROWS? " & intRows & "</font></b>")

if err.number <> 0 then
response.write ("error in INSERT sub: ")
response.write "uggggh: #" & Err.Number & ".\nError Message: " & Err.Description & ".\nHelp Context: " & Err.HelpContext & ".\nError Source: " & Err.Source & "."
end if

If intRows < 1 Then
response.write("<b>NO RECORDS RETURNED</B>")
'THIS IS PRINTED, AND THERE IS NO RECORDS BEING PASSED HERE, YET, PULLING THE QUERIES AND RUNNING THEM PROVES SUCCESSFUL
rsi.Close
Set rsi = Nothing
Exit Sub
End If

While Not rsi.EOF
strType = rsi.Fields("fType")
response.write("yes: " & strType & "<br>")
rsi.MoveNext
Wend

rsi.Close
Set rsi = Nothing

End Sub
%>
Reply With Quote
  #4 (permalink)  
Old 03-31-08, 12:39
gvee gvee is offline
www.gvee.co.uk
 
Join Date: Jan 2007
Location: UK
Posts: 10,156
My first guess is that the recordset object is not being created; you're going to have to do a bit more debugging methinks matey!

If you are sure the object is being instantiated then the next one to check is whether your connection is opening correctly; I imagine your conection string has changed since you've moved servers/

Final thought: please do not post the same question more than once - post a single one where you deem most appropriate and we'll move it if we think it sits somewhere better

Good luck!
__________________
George
Twitter | Blog
Reply With Quote
  #5 (permalink)  
Old 03-31-08, 12:44
SEAQUIL SEAQUIL is offline
Registered User
 
Join Date: Mar 2008
Posts: 6
No problemo
Reply With Quote
  #6 (permalink)  
Old 03-31-08, 12:59
SEAQUIL SEAQUIL is offline
Registered User
 
Join Date: Mar 2008
Posts: 6
Question: Are you the only one solving problems on this site? I see your name everywhere...

Here's a follow up to my problem, the connection string works great for everything else.

A simple select query prints data to the screen in a snap, so the object is being created...

I'm trying to get down to business by asking "Why won't aggregate functions work all of a sudden?"

Anyone else want to take a CLOSER look?
Reply With Quote
  #7 (permalink)  
Old 04-01-08, 07:59
gvee gvee is offline
www.gvee.co.uk
 
Join Date: Jan 2007
Location: UK
Posts: 10,156
Quote:
Originally Posted by SEAQUIL
Question: Are you the only one solving problems on this site? I see your name everywhere...
Haha, nope, but as you can see I am quite prolific

Well in your code posted above you wern't using an aggregate function; hence my initial questionning!

So you've proved that you're opening a recordset... What happens when you test for EOF / BOF?
__________________
George
Twitter | Blog
Reply With Quote
  #8 (permalink)  
Old 04-01-08, 15:21
Teddy Teddy is offline
Purveyor of Discontent
 
Join Date: Mar 2003
Location: The Bottom of The Barrel
Posts: 6,075
Sounds like a job for profiler. Find out what's actually being sent to the server you so you can ensure you're requesting and receiving the correct data. Work from there.
__________________
oh yeah... documentation... I have heard of that.

*** What Do You Want In The MS Access Forum? ***
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On