Re: SQLdatasource delete with parameter output



The problem is - and I(from links given to you) figure that is a framework
bug- you can only retrieve those. The parameters that are declared in the
collection at design time (can be seen in the control markup on the
ASPX/ASCX) are not accessible on the Inserted event using this method. So
basically now I can access the Return and Output I added programmatically
during Insert but not those that were already declared. Very weird.


"Madison" <Madison@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:3F27AA99-0E16-4E99-B4B7-1C6842B66FA8@xxxxxxxxxxxxxxxx
Hi all,
I have troublem to get parameters output to return value back. I'm using
SQLdatasource and stored procedure to get information and delete row from
gridview. I don't have any problems get information and display but when I
want to delete some row from gridview and return parameters output back
with
status or some message, the parameter return dbNull value. Any ideas what
is
happen? Here is my code:
-- SqlDataSourece --
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$
ConnectionStrings:cnFOE %>"
DeleteCommand="p_siteproject_delete_measure"
DeleteCommandType="StoredProcedure"
SelectCommand="p_siteproject_measure_installed"
SelectCommandType="StoredProcedure">

<DeleteParameters>
<asp:SessionParameter Name="SiteProjectID"
SessionField="siteprojectid" Type="Int32" />
<asp:SessionParameter Name="MeasureID"
SessionField="measureid" Type="Int32" />
<asp:Parameter Direction="InputOutput" Name="mess"
Type="string" />
<asp:Parameter Direction="InputOutput" Name="ret"
type="int16" />
</DeleteParameters>
<SelectParameters>
<asp:SessionParameter Name="SiteProjectId"
SessionField="siteprojectid" Type="Int32" />
<asp:SessionParameter Name="sectorcd"
SessionField="sectorcd" Type="String" />
</SelectParameters>
</asp:SqlDataSource>

-- Call event --
Protected Sub SqlDataSource1_Deleted(ByVal sender As Object, _
ByVal e As System.Web.UI.WebControls.SqlDataSourceStatusEventArgs)
Handles SqlDataSource1.Deleted

Dim strMess As String
strMess = e.Command.Parameters("@mess").Value

'Dim ireturn As Integer
'ireturn = e.Command.Parameters("@ret").Value

End Sub

-- stored procedure --
I can run stored procedure and see the parameters output

ALTER PROCEDURE [dbo].[p_siteproject_delete_measure]
@SiteProjectID Int = null,
@MeasureID Int = null,
@mess VarChar(255)= null OUTPUT,
@ret Int = null OUTPUT
AS
BEGIN

SET NOCOUNT ON;

SET @mess = 'Will Delete this measure'
SET @ret = 2

END

Please help.



.



Relevant Pages

  • Re: SQLdatasource delete with parameter output
    ... I have troublem to get parameters output to return value back. ... 'Dim ireturn As Integer ... @SiteProjectID Int = null, ... @ret Int = null OUTPUT ...
    (microsoft.public.dotnet.framework.adonet)
  • SQLdatasource delete with parameter output
    ... I have troublem to get parameters output to return value back. ... SQLdatasource and stored procedure to get information and delete row from ... want to delete some row from gridview and return parameters output back with ... @SiteProjectID Int = null, ...
    (microsoft.public.dotnet.framework.adonet)