473,397 Members | 2,028 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,397 software developers and data experts.

Returning SQL Server Messages to ASP

Hi all,

Is there a way I can return an SQL server response message through an ASP
page?

Right now when I run a command through the Query Analyzer (such as an
insert, update, delete, etc. statement), I will get a message in the
response window (ie: 1 row(s) affected). What is the variable that I would
need to add to my ASP page to show this result.

I'm not interested in returning data, just this response to an SQL command.

Thanks,

Brian.
(remove NOSPAM to email me directly)
Nov 18 '05 #1
2 1484
On Wed, 23 Jun 2004 12:32:34 -0400, "Brian Piotrowski"
<bp*********@NOSPAM.simcoeparts.com> wrote:
Hi all,

Is there a way I can return an SQL server response message through an ASP
page?

Right now when I run a command through the Query Analyzer (such as an
insert, update, delete, etc. statement), I will get a message in the
response window (ie: 1 row(s) affected). What is the variable that I would
need to add to my ASP page to show this result.

I'm not interested in returning data, just this response to an SQL command.

Thanks,

Brian.
(remove NOSPAM to email me directly)


This message returned from QA depends upon the SQL Server system
variable @@RowCount which returns the number of rows affected by
the last statement.

For instance if you were querying the Pubs database in QA with:

SELECT * FROM Authors WHERE state = 'CA'

The message you get is:

15 row(s) affected

This can be simulated with:

Select * From Authors where state = 'CA'
Select CAST(@@rowcount AS VarChar) + ' row(s) affected'

So I guest you would just return the last row of your SProc.

I think you should ask SQL Server specific questions in a more
relevant ng such as news:microsoft.public.sqlserver.misc

Nov 18 '05 #2
Select * From Authors where state = 'CA'
Select CAST(@@rowcount AS VarChar) + ' row(s) affected'

So I guest you would just return the last row of your SProc.


Brian, instead of doing this, modify it a bit so you can return a scalar
value as an output parameter back instead of having to open a datareader or
dataset and go into the items collection to get the value.. thats too much
work.

create proc MyProc @state char(2), @outputVar varchar(30) OUTPUT

Select * From Authors where state = @state

set @outputVar = CAST(@@RowCount As VarChar(10)) + ' row(s) affected.'

Return
Go


Nov 18 '05 #3

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

Similar topics

4
by: Madestro | last post by:
Hi guys, I am making a small program to retrieve e-mails from POP accounts. I got all the e-mail parsing stuff figured out, but I cannot seem to come up with a way to find out which e-mails are...
5
by: rhungund | last post by:
Hi All. My question is this. I have a complex stored procedure in SQL Server which works fine when I run it in Query Analyzer. However, when I call it within my ASP script, it returns nothing,...
0
by: Jonas Hei | last post by:
I need to develop a scalable server which has to receive and send UDP messages. It is required to process hundreds of messages (coming from different remote computers) per second (possibly even...
4
by: Daniel Bass | last post by:
Hey, I've been asked to look into network security where an IIS virtual directory is configure to not have anonymous access, but rather to go with the windows authentication (what the user...
5
by: zorhel | last post by:
Hi. My clients will be IE, Mozilla and Opera in a Windows and *nix OS. So, my web app need to, from a server, send messages to a specific client (browser), send messages for all clients,...
2
by: Mały Piotruś | last post by:
Hello, (sorry for my English...) Could you help me please with installing SQL Servera 2005 Express Edition. I downloaded files: SQLEXPR.EXE - Microsoft SQL Server 2005 Express Edition...
23
by: Peter | last post by:
I have a problem with a page show_image.asp that returns a jpg image under Windows XP Pro SP2. The page sets content type as: Response.ContentType = "image/jpg" While this works perfectly fine...
7
by: Guy Davidson | last post by:
Hi Folks, I'm having some issues with an small socket based server I'm writing, and I was hoping I could get some help. My code (attached below) us supposed to read an HTTP Post message...
2
by: FutureShock | last post by:
I am using a registration class to process a registration form and need some opinions on returning error messages. I am self referring the page on submit. I would like to send each form field...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.