[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.inetserver.asp.db

michael kors handbags outlet dp42

Katadedajab

12/25/2013 3:17:00 PM

<a href=http://www.martinet-finewines.com/mk5.html><b&... kors outlet</b></a>Thanks as well as for the chance to educate yourself regarding win these an all in one great giveaway as high as the look at looks gorgeous and as an example a lot better include them as able for more information on win a signed back up.<a href=http://www.stfranciswolves.com/mkstore.html><... michael kors outlet</b></a>
<a href=http://www.thewizardofart.com/mkstore.html><b&... kors outlet</b></a>Thanks and then for that,element does be of assistance a parcel for more information regarding make an appointment with a multi function comment judging by the author and a resource box also looks is fantastic.<a href=http://www.portraitsinternational.com/mkonline6.html><... michael kors outlet</b></a>
<a href=http://www.thewizardofart.com/mkstore.html><b&... kors outlet</b></a>When all your family members read this article, I'm a specific you not only can they select your personal preferences,choose going to be the part similar to your merchandise, your life colorful,all your family members will be the case a multi functional super star as part of your world never miss best chance now.<a href=http://www.martinet-finewines.com/mk5.html><b&... kors handbags outlet</b></a>
<a href=http://www.martinet-finewines.com/mk5.html><b&... kors outlet</b></a>That will be the a multi functional awesome trick thanks too sharing going to educate yourself regarding keep aspect on mind<a href=http://www.roadtripsinc.com/contact-us.htm><b&... kors purses outlet</b></a>
3 Answers

Tom Garth

7/4/2007 1:58:00 PM

0

Kerry is right on the money. It works well with stored procedures too. In the
example I give below, the stored procedure returns the new identity value.
However the example will retrieve whatever return value is coded into the
stored procedure, so it's utility isn't just for new identies.

cmd.CommandText = ""DECLARE @RETURN int; EXEC @RETURN = CustInsert 'John
Smith', '3/15/1959'; SELECT @RETURN [RETURN]"

It's actually a generic wrapper that looks like -

"DECLARE @RETURN int; EXEC @RETURN = " & s & "; SELECT @RETURN [RETURN]"

where s is the procedure with parameters built outside the function.

If you are writing tons of DB code, you don't want to have to deal with
parameter objects, since they don't offer any performance advantage anyway.
--
Tom Garth


"Kerry Moorman" wrote:

> Bill,
>
> With SQL Server, Scope_Identity is more reliable than @@Identity.
>
> One technique is to batch a Select Scope_Identity() statement with the
> Insert statement. For a command object named cmd:
>
> cmd.CommandText = "Insert Into ... ; Select Scope_Identity()"
>
> Then, instead of using ExecuteNonQuery, use ExecuteScalar. To retrieve the
> identity value into an ID variable:
>
> ID = cmd.ExecuteScalar
>
> Kerry Moorman
>
>
> "Bill Gower" wrote:
>
> > I am using a ExecuteNonQuery() to insert a record into a SQL Server
> > database. How do I retrieve the identity value of the row just inserted?
> >
> > Bill
> >
> >
> >

Cor Ligthert [MVP]

7/4/2007 5:35:00 PM

0

Rad,

Why should it be a sproc and can it not dynamicly?

Cor

"Rad [Visual C# MVP]" <rad@nospam.com> schreef in bericht
news:%2307vY8ZvHHA.2040@TK2MSFTNGP03.phx.gbl...
> Kerry Moorman wrote:
>> Bill,
>>
>> With SQL Server, Scope_Identity is more reliable than @@Identity.
>>
>> One technique is to batch a Select Scope_Identity() statement with the
>> Insert statement. For a command object named cmd:
>>
>> cmd.CommandText = "Insert Into ... ; Select Scope_Identity()"
>>
>> Then, instead of using ExecuteNonQuery, use ExecuteScalar. To retrieve
>> the identity value into an ID variable:
>>
>> ID = cmd.ExecuteScalar
>>
>> Kerry Moorman
>>
>>
>> "Bill Gower" wrote:
>>
>>> I am using a ExecuteNonQuery() to insert a record into a SQL Server
>>> database. How do I retrieve the identity value of the row just
>>> inserted?
>>>
>>> Bill
>>>
>>>
>>>
> Another alternative is to use a stored procedure to do the insert, and in
> that procedure have an output parameter that will populate with the new
> identity value.
>
> --
> http://bytes.thinke...


Rad [Visual C# MVP]

7/4/2007 7:14:00 PM

0

Cor Ligthert [MVP] wrote:
> Rad,
>
> Why should it be a sproc and can it not dynamicly?
>
> Cor
>
> "Rad [Visual C# MVP]" <rad@nospam.com> schreef in bericht
> news:%2307vY8ZvHHA.2040@TK2MSFTNGP03.phx.gbl...
>> Kerry Moorman wrote:
>>> Bill,
>>>
>>> With SQL Server, Scope_Identity is more reliable than @@Identity.
>>>
>>> One technique is to batch a Select Scope_Identity() statement with the
>>> Insert statement. For a command object named cmd:
>>>
>>> cmd.CommandText = "Insert Into ... ; Select Scope_Identity()"
>>>
>>> Then, instead of using ExecuteNonQuery, use ExecuteScalar. To retrieve
>>> the identity value into an ID variable:
>>>
>>> ID = cmd.ExecuteScalar
>>>
>>> Kerry Moorman
>>>
>>>
>>> "Bill Gower" wrote:
>>>
>>>> I am using a ExecuteNonQuery() to insert a record into a SQL Server
>>>> database. How do I retrieve the identity value of the row just
>>>> inserted?
>>>>
>>>> Bill
>>>>
>>>>
>>>>
>> Another alternative is to use a stored procedure to do the insert, and in
>> that procedure have an output parameter that will populate with the new
>> identity value.
>>
>> --
>> http://bytes.thinke...
>
>

Cor,

Doesn't have to be a sproc ... I was just floating another alternative

--
http://bytes.thinke...