473,802 Members | 2,446 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DAAB output pararmeters

Hello,

I'm using ASP.Net 2.0 and the Jan 2006 Enterprise Library.

What I'm doing is passing an ArrayList into a stroed procedure to do an
Insert. Here's some code:

Dim params as New ArrarList
params.Add("fir st parameter value")
params.Add("sec ond parameter value")
etc.

db.ExecuteNonQu ery(transaction , "sproc_Inse rt", params.ToArray)
tansaction.Comm it()

Obviously some code is missing, which doesn't matter because the insert
works. The problem I'm not sure how to get around is how can I get the ID of
the inserted record out of hte stored procedure using this same method or is
there a way to add something to what I'm doing to get the @@indentity from
the SPROC.

Any suggestions are welcomed.

Thanks
Clint Pidlubny
Nov 9 '06 #1
4 3393
Something along these lines.
db.AddOutParame ter( "@numberRowsAff ected", DbType.Int32, 0)

Dim rowsAffected As Int32

rowsAffected = db.ExecuteNonQu ery()

' Row of data is captured via output parameters
Dim results As String =
String.Format(C ultureInfo.Curr entCulture, "{0}", db.GetParameter Value(
"@numberRowsAff ected"))
"@numberRowsAff ected is if you declare an output parameter for the stored
procedure and populate it

rowsAffected works also, BUT doesn't work against select queries.

I usually include the output parameter and populate that way, if I want
IDENTITY or any other value.


"Clint Pidlubny" <Clint Pi******@discus sions.microsoft .comwrote in message
news:82******** *************** ***********@mic rosoft.com...
Hello,

I'm using ASP.Net 2.0 and the Jan 2006 Enterprise Library.

What I'm doing is passing an ArrayList into a stroed procedure to do an
Insert. Here's some code:

Dim params as New ArrarList
params.Add("fir st parameter value")
params.Add("sec ond parameter value")
etc.

db.ExecuteNonQu ery(transaction , "sproc_Inse rt", params.ToArray)
tansaction.Comm it()

Obviously some code is missing, which doesn't matter because the insert
works. The problem I'm not sure how to get around is how can I get the ID
of
the inserted record out of hte stored procedure using this same method or
is
there a way to add something to what I'm doing to get the @@indentity from
the SPROC.

Any suggestions are welcomed.

Thanks
Clint Pidlubny

Nov 9 '06 #2
Thanks for trying but that isn't what I'm looking for.

I'm only passing an ArrayList and letting SQL Server match up the
parameters, so I'm not specifically stating the parameters. I actually don't
have a problem getting the # of rows affected, but what I'm not sure about is
how to pass the @@identity when I'm only passing an ArrayList for the
parameters.

It might not be possible, but I thought I'd check.

Thanks anyways.

Clint

"sloan" wrote:
Something along these lines.
db.AddOutParame ter( "@numberRowsAff ected", DbType.Int32, 0)

Dim rowsAffected As Int32

rowsAffected = db.ExecuteNonQu ery()

' Row of data is captured via output parameters
Dim results As String =
String.Format(C ultureInfo.Curr entCulture, "{0}", db.GetParameter Value(
"@numberRowsAff ected"))
"@numberRowsAff ected is if you declare an output parameter for the stored
procedure and populate it

rowsAffected works also, BUT doesn't work against select queries.

I usually include the output parameter and populate that way, if I want
IDENTITY or any other value.


"Clint Pidlubny" <Clint Pi******@discus sions.microsoft .comwrote in message
news:82******** *************** ***********@mic rosoft.com...
Hello,

I'm using ASP.Net 2.0 and the Jan 2006 Enterprise Library.

What I'm doing is passing an ArrayList into a stroed procedure to do an
Insert. Here's some code:

Dim params as New ArrarList
params.Add("fir st parameter value")
params.Add("sec ond parameter value")
etc.

db.ExecuteNonQu ery(transaction , "sproc_Inse rt", params.ToArray)
tansaction.Comm it()

Obviously some code is missing, which doesn't matter because the insert
works. The problem I'm not sure how to get around is how can I get the ID
of
the inserted record out of hte stored procedure using this same method or
is
there a way to add something to what I'm doing to get the @@indentity from
the SPROC.

Any suggestions are welcomed.

Thanks
Clint Pidlubny


Nov 9 '06 #3
You'll have to pass it in some parameter form. You'll need to either use the
return result parameter (if the identity is an integer) or another parameter
defined as an output.

Also, don't use @@IDENTITY. What you want is SCOPE_IDENTITY( ). Using
@@Identity returns the last insert record, anywhere. If another insert
happens at close to the same time SQL Server will grab that one. Using
SCOPE_IDENTITY( ) ensures that the identity being returned is the last one
that was added within the scope of the current operation, such as the
current stored procedure
--
Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006

"Clint Pidlubny" <Cl***********@ discussions.mic rosoft.comwrote in message
news:D8******** *************** ***********@mic rosoft.com...
Thanks for trying but that isn't what I'm looking for.

I'm only passing an ArrayList and letting SQL Server match up the
parameters, so I'm not specifically stating the parameters. I actually
don't
have a problem getting the # of rows affected, but what I'm not sure about
is
how to pass the @@identity when I'm only passing an ArrayList for the
parameters.

It might not be possible, but I thought I'd check.

Thanks anyways.

Clint

"sloan" wrote:
>Something along these lines.
db.AddOutParame ter( "@numberRowsAff ected", DbType.Int32,
0)

Dim rowsAffected As Int32

rowsAffected = db.ExecuteNonQu ery()

' Row of data is captured via output parameters
Dim results As String =
String.Format( CultureInfo.Cur rentCulture, "{0}", db.GetParameter Value(
"@numberRowsAf fected"))
"@numberRowsAf fected is if you declare an output parameter for the stored
procedure and populate it

rowsAffected works also, BUT doesn't work against select queries.

I usually include the output parameter and populate that way, if I want
IDENTITY or any other value.


"Clint Pidlubny" <Clint Pi******@discus sions.microsoft .comwrote in
message
news:82******* *************** ************@mi crosoft.com...
Hello,

I'm using ASP.Net 2.0 and the Jan 2006 Enterprise Library.

What I'm doing is passing an ArrayList into a stroed procedure to do an
Insert. Here's some code:

Dim params as New ArrarList
params.Add("fir st parameter value")
params.Add("sec ond parameter value")
etc.

db.ExecuteNonQu ery(transaction , "sproc_Inse rt", params.ToArray)
tansaction.Comm it()

Obviously some code is missing, which doesn't matter because the insert
works. The problem I'm not sure how to get around is how can I get the
ID
of
the inserted record out of hte stored procedure using this same method
or
is
there a way to add something to what I'm doing to get the @@indentity
from
the SPROC.

Any suggestions are welcomed.

Thanks
Clint Pidlubny



Nov 9 '06 #4
Thanks Mark. I didn't know that about @@Identity. Have you ever tried passing
a parameter through an ArrayList, like I describe, or do I have to take a
different approach if I want to grab an identity?

Clint

"Mark Fitzpatrick" wrote:
You'll have to pass it in some parameter form. You'll need to either use the
return result parameter (if the identity is an integer) or another parameter
defined as an output.
Also, don't use @@IDENTITY. What you want is SCOPE_IDENTITY( ). Using
@@Identity returns the last insert record, anywhere. If another insert
happens at close to the same time SQL Server will grab that one. Using
SCOPE_IDENTITY( ) ensures that the identity being returned is the last one
that was added within the scope of the current operation, such as the
current stored procedure
--
Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006
Nov 13 '06 #5

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

Similar topics

0
5414
by: sedefo | last post by:
I ran into this Microsoft Patterns & Practices Enterprise Library while i was researching how i can write a database independent data access layer. In my company we already use Data Access Application Block (DAAB) in our .Net projects. We use SqlHelper in SQL based projects, and OracleHelper in Oracle based ones. OracleHelper was not published officially by Microsoft as part of the DAAB but it was given as a helper code in a sample .Net...
1
1849
by: Özgür Aytekin | last post by:
Hello NG Is DAAB 3.1 the offical replacement of Microsoft Data Access Application Block 2.0? DAAB 3.1 download: http://www.gotdotnet.com/Community/Workspaces/viewuploads.aspx?id=c20d12b0-af52-402b-9b7c-aaeb21d1f431 We'll use for our online stock exchange game (www.borsagame.com) a data access application block with source code. But, we are not sure, which one is better. DAAB 3.1 or MS Data Access Application Block 2.0?
3
3966
by: veera sekhar kota | last post by:
hi, im seriously looking for right answer .... We are developing windows application in c#. I implemented DAAB(Data Access Application Block) 2.0 in our application. One of the senior asked me to implement DAAB in enterprise library. I said DAAB 2.0 having more performance(data accessing) compare to enterprise library DAAB. And we not using the features of DAAB in enterprise
0
1572
by: veera sekhar kota | last post by:
im seriously looking for right answer .... We are developing windows application in c#. I implemented DAAB(Data Access Application Block) 2.0 in our application. One of the senior asked me to implement DAAB in enterprise library. I said DAAB 2.0 having more performance(data accessing) compare to enterprise library DAAB. And we not using the features of DAAB in enterprise library.
0
1446
by: veera sekhar kota | last post by:
im seriously looking for right answer .... We are developing windows application in c#. I implemented DAAB(Data Access Application Block) 2.0 in our application. One of the senior asked me to implement DAAB in enterprise library. I said DAAB 2.0 having more performance(data accessing) compare to enterprise library DAAB. And we not using the features of DAAB in enterprise library.
7
1664
by: Alec MacLean | last post by:
Hi all, I'm trying to deploy an ASP.NET (1.1) app to our production webserver, but having problems with the DAAB (from Ent Lib June 2005). As you might guess, it works just fine and dandy on my dev PC (VS2003). The error I'm getting on the production server is: The type initializer for "Microsoft.Practices.EnterpriseLibrary.Data.Instrumentation.DataConnectionFailedEvent" threw an exception
8
2704
by: Alec MacLean | last post by:
Hi, I'm using the DAAB Ent Lib (Jan 2006) for .NET 2.0, with VS 2005 Pro. My project is a Web app project (using the WAP add in). Background: I'm creating a survey system for our company, for which invites will target selected personnel among our customers via email. Each email will provide a custom hyperlink for each respondent using a SQL generated GUID value in the querystring. The GUID will be checked for validity before the user...
5
1651
by: | last post by:
Hi, I'm having difficulty connecting my .NET web app to my SQL2000 database via the DAAB. I'm using VS2003 with .NET 1.1. I'm currently trying names such as Initial Catalog, Data Source, User ID and Password. But i have previously attempted server, database, user, uid, Pwd, etc. all to no avail. The user and password i've supplied do provide access to the database
0
948
by: dobee | last post by:
Hi all, currently via ado.net, to read an external file we can do this: DataSet myDS = new DataSet(); myDS.ReadXml("input.xml", XmlReadMode.ReadSchema); but i cant seem to find any equivalent for daab. anyone has tried using daab to read from an xml file and output to a website? Thanks!
0
9562
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
10536
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
10304
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...
1
10285
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10063
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...
0
9114
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7598
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
6838
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4270
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

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.