473,326 Members | 2,114 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Problem using COMPUTE with SPROC on ASP Application

This will be obvious to some - but not me I'm afraid...

I am using an SQL data link from my ASP application to a SPROC - this all
works fine on standard SELECT statements and JOIN in to a datagrid in my
application. Rather than messing around with the code/server resource, I
thought I would add a COMPUTE line to the bottom of the SPROC to return a
total for one of the columns.

This all works fine in Query Analyser - I have a handle on using output
variables etc. but what is the best way to do this. I do not seem to be able
to get the COMPUTE statement to output to a variable - I get various erros
depending on what I try...

This works in Query Analyser and outputs the COMPUTE statement - how do I
alter this to get the value in to a variable ? The input variables defined
below work fine and this query obviously executes following 2 input
parameters defined by the user viewing the site...

CREATE PROCEDURE SPROC

(
@Date datetime,
@SalesID char
)

AS

SELECT ****Various fields****

FROM ****3 different Databases with pre-defined JOIN****

WHERE (SOR_ORDER_HISTORY.ORDER_DATE = @Date AND
SOR_HISTORY_TRANS.TRAN_SPARE_NUMBER_2 = @SalesID)

ORDER BY SOR_ORDER_HISTORY.THIS_RECORD
COMPUTE SUM(SOR_HISTORY_TRANS.LINE_TOTAL)
GO

Thanks very much for your time
Nov 18 '05 #1
1 1364
Hi skirkby:

Are you trying to get totals and subtotals for a grid display?
One example:
http://msdn.microsoft.com/library/de...ta01102002.asp

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Mon, 1 Nov 2004 00:02:05 -0800, "skirkby"
<sk*****@discussions.microsoft.com> wrote:
This will be obvious to some - but not me I'm afraid...

I am using an SQL data link from my ASP application to a SPROC - this all
works fine on standard SELECT statements and JOIN in to a datagrid in my
application. Rather than messing around with the code/server resource, I
thought I would add a COMPUTE line to the bottom of the SPROC to return a
total for one of the columns.

This all works fine in Query Analyser - I have a handle on using output
variables etc. but what is the best way to do this. I do not seem to be able
to get the COMPUTE statement to output to a variable - I get various erros
depending on what I try...

This works in Query Analyser and outputs the COMPUTE statement - how do I
alter this to get the value in to a variable ? The input variables defined
below work fine and this query obviously executes following 2 input
parameters defined by the user viewing the site...

CREATE PROCEDURE SPROC

(
@Date datetime,
@SalesID char
)

AS

SELECT ****Various fields****

FROM ****3 different Databases with pre-defined JOIN****

WHERE (SOR_ORDER_HISTORY.ORDER_DATE = @Date AND
SOR_HISTORY_TRANS.TRAN_SPARE_NUMBER_2 = @SalesID)

ORDER BY SOR_ORDER_HISTORY.THIS_RECORD
COMPUTE SUM(SOR_HISTORY_TRANS.LINE_TOTAL)
GO

Thanks very much for your time


Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: adrian | last post by:
hi all this is my first post to this group, so pls bear with me while i try to make some sense. i am trying to create a sproc which uses dynamic sql to target a particuar table eg. '.' and...
8
by: Bruce Stockwell | last post by:
the setup: Webservice/WinClient application/SQL server. VS.Net (visual basic) winform wizard creates a simple form with load cancel cancelall and datagrid bound to a simple Dataset with one...
1
by: teddysnips | last post by:
SQL Server 2000 I have a stored procedure that uses an extended SPROC to send an email notification to my customers when a document is distributed. However, the SPROC has an unexpected side...
2
by: nigel | last post by:
Hello I am using a temp table called ##temp in an SProc but often get the message that the table already exists. Could this be because the SProc is being run by more than 2 webpages at the same...
4
by: Dino Buljubasic | last post by:
Hi, I am using a function to hash a string value: public string generateMD5Hash(string input) { MD5 md5Provider; // MD5 provider instance // generate byte code for input byte inputData =...
2
by: thebison | last post by:
Hi, As a relative newbie to SQL Server/ASP.NET I'm hoping someone here can help with my problem. I'm developing a timesheet application in ASP.NET C# using Visual Studio 2003 with a database...
0
by: Sean | last post by:
Using SqlDataSource controller with sprocs and its been working fairly well. I changed a table by removing a foreign key, removing 2 columns and adding 3. I rewrote the update sproc and works fine...
0
by: loudfish | last post by:
Hi there, I'm looking to get SSIS to run database backup and restore tasks as part of an overall process. But I have a few problems. 1. The "Backup Database Task" does not seem to allow...
2
by: Lauren Quantrell | last post by:
I can pass the XML below to a sproc from within a vb.net application but it doesn't work to the same sproc from an Access application. I've tried massaging the double quotes without success. Any...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.