und die bekomme ich dann in einem dataset zur�ck? da muss ich doch in meiner vb-funktion auch was �ndern, oder?

----- Original Message ----- From: "Christoph Schmid" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Tuesday, March 29, 2005 9:14 PM
Subject: Re: [Asp.net] neue id zur�ckbekommen



Hallo

Direkt nach dem INSERT kannst du mit
SCOPE_IDENTITY() auf die ID zugreiffen.
Ich mache da jeweils:
SELECT @id=isNull(SCOPE_IDENTITY(),-1)

Gruss Christoph



Thomas Beckert wrote:

hi liste. ich habe folgende stored-procedure:
CREATE PROCEDURE thema_insert
@thema Char(200), @nummer Int, @online Bit
AS
INSERT INTO thema
VALUES(@thema,@nummer,@online)
GO
die rufe ich mit folgender funktion auf:
Function insertThema(ByVal thema As String, ByVal nummer As Integer, ByVal online As Boolean) As Integer
Try
Dim strProcedure As String
Dim MyParam As SqlParameter
strProcedure = "thema_Insert"
Dim objConnect As New SqlConnection(Me.connString)
Dim objCommand As New SqlCommand(strProcedure,objConnect)
objCommand.CommandType = CommandType.StoredProcedure


MyParam = objCommand.Parameters.Add("@thema", SqlDbType.VarChar,200)
MyParam.Value = thema
MyParam = objCommand.Parameters.Add("@nummer", SqlDbType.Int)
MyParam.Value = nummer
MyParam = objCommand.Parameters.Add("@online", SqlDbType.Bit)
MyParam.Value = online
objConnect.Open()
objCommand.ExecuteNonQuery()
objConnect.Close()
return 0
Catch ex As exception
return 1
End Try
End Function
wie muss ich das ganze denn umschreiben, damit ich die neu erzeugte id zur�ckgeliefert bekomme ???

_______________________________________________ Asp.net Mailingliste, Postings senden an: [email protected] An-/Abmeldung und Suchfunktion unter: http://www.glengamoi.com/mailman/listinfo/asp.net


_______________________________________________ Asp.net Mailingliste, Postings senden an: [email protected] An-/Abmeldung und Suchfunktion unter: http://www.glengamoi.com/mailman/listinfo/asp.net

Antwort per Email an