0

vbコードでスコープIDパラメーターを取得するにはどうすればよいですか。私はこれまでにこれを持っています...

    InsertCommand="INSERT INTO [table_name] ([title], [subtitle], [description], [image1], [image1_caption], [image2], [pdf], [meta_description], [meta_keywords]) VALUES (@title, @subtitle, @description, @image1, @image1_caption, @image2, @pdf, @meta_description, @meta_keywords); SELECT @NewID = SCOPE_IDENTITY()"

<asp:Parameter Direction="Output" Name="NewID" Type="Int32" />

DetailsView1_ItemInsertedでこのIDを取得するにはどうすればよいですか?

もう情報が必要な場合は私に知らせてください。

ありがとう

4

1 に答える 1

0

ItemInsertedイベントハンドラーでこれを試しましたか?

Sub EmployeeDetailsSqlDataSource_OnInserted(sender As Object, e As SqlDataSourceStatusEventArgs)
    Dim command As System.Data.Common.DbCommand = e.Command  
    EmployeesDropDownList.DataBind()
    EmployeesDropDownList.SelectedValue = _
      command.Parameters("@NewID").Value.ToString()
    EmployeeDetailsView.DataBind()
End Sub

パラメータ方向属性が必要かどうかわからない。

このMSDNの記事をチェックしてください。彼らはあなたが試みていることを正確に実行します。

http://msdn.microsoft.com/en-us/library/xt50s8kz(VS.80).aspx

于 2010-09-24T23:46:56.967 に答える