[thelist] Using @@Identity
Serdar Kılıç
skilic at gmail.com
Tue Aug 23 19:09:10 CDT 2005
I didn't catch the beginning of this thread, but have a look at
SCOPE_IDENTITY() , @@IDENTITY is global across the server(?), whilst
SCOPE_IDENTITY is for the current context.
On 24/08/05, Casey <aspnet at thecrookstons.com> wrote:
>
> Ok. Wrong subject. Once again...
>
>
> I was able to get this far (see below) from:
>
>
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_globals_50u1.asp
>
> Now I just need to know how to retreive the value of Identity. All this is
> being done in ASP.NET <http://ASP.NET> using VB and an MS SQL Database.
> The colum in
> question is doc_id which is set as the auto-incrementing Primary Key.
>
> Any pointers?
>
> TIA!!
>
> Dim conAddDoc As SqlConnection = New
> SqlConnection(System.Configuration.ConfigurationSettings.AppSettings
> ("MccCon
> String"))
>
> Dim strInsert As String = "Insert MCCIME_Doctor (fname, lname, specialty,
> ...) VALUES (@fname, @lname, @specality, ...) SELECT @@IDENTITY AS
> 'Identity'"
>
> Dim cmdInsert As SqlCommand = NEW SqlCommand(strInsert, conAddDoc)
>
> conAddDoc.Open
> cmdInsert.ExecuteNonQuery()
> conAddDoc.Close
>
>
>
> --
>
> * * Please support the community that supports you. * *
> http://evolt.org/help_support_evolt/
>
> For unsubscribe and other options, including the Tip Harvester
> and archives of thelist go to: http://lists.evolt.org
> Workers of the Web, evolt !
>
--
Cheers,
Serdar Kilic
http://weblog.kilic.net/
More information about the thelist
mailing list