473,738 Members | 6,332 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1497
On Wed, 23 Jun 2004 12:32:34 -0400, "Brian Piotrowski"
<bp*********@NO SPAM.simcoepart s.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.sqlserve r.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
1822
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 NEW so I don't have to retrieve them all. If you have experience with this kind of thing, you know that the server creates unique IDs for all the messages, but this IDs are not guaranteed to be unique, since they can be reused once a message is...
5
2605
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, and sometimes locks up. If I change my script to call other existing stored procedures it works fine. It's just with this particular stored proc. I have tried various DB calls in ASP, such as opening the recordset through an ADO connection and...
0
367
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 thousands) and of course I would like to make it as performant and scalable as I can. The idea is that remote computers send data to this server. The remote computers will send data from any random port to port 28901 of my server. My server then...
4
1400
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 signs in as at client). This is in the context of a ASP.Net web service running on an intranet. - I've ticked and unticked all the right boxes in IIS.
5
4854
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, redirect a client to another page. In other way, a client will be able to send messages to another client, throw the server. These are the first funcionalities.
2
11059
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 SSEUtilSetup.EXE - SQL Server Express Utility SqlServer2K5_BOL_Dec2005.msi - Books Online December 2005 and I tried to run them sequentially. After installing SQLEXPR.EXE
23
5932
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 on most machines, on some machines I experience this problem: When loading the page a window pops up that asks if I want to open the document show_page.asp. When I click "Open" Interdev pops up and opens up a
7
4017
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 coming from a power meter, parse it, and return a proper HTTP 200 Ok message. The problem is that the socket fails to send the entire message as one message, creating a fragmented message which the power meter then fails to read and accept.
2
1872
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 to the class for processing (validating, sanitizing, etc..) So far no problem. Now I am throwing ideas around on how best to check for error messages to the users.
0
8968
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8787
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9473
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9334
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9208
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6750
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4824
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3279
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2744
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.