I want to return the value @ID from the insert statement. Does anybody know how i would achieve this?Code:Dim SQLData As New System.Data.SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings("FixedLineProvisioningConnectionString").ToString()) Dim cmdSelect As New System.Data.SqlClient.SqlCommand("INSERT INTO tblTotalComms_custinfo SET nt_username=@nt_username; SELECT @ID=SCOPE_IDENTITY()", SQLData) cmdSelect.Parameters.AddWithValue("@nt_username", Page.User.Identity.Name) cmdSelect.Parameters.Add("@ID", System.Data.SqlDbType.Int, 4, "ID").Direction = Data.ParameterDirection.Output SQLData.Open() SQLData.Close() w.HeaderText = "Order Number " & Session("OrderNo")




Reply With Quote