ASP.NET / MySQL SQLDataSource StoredProcedure
本文关键字:SQLDataSource StoredProcedure MySQL NET ASP | 更新日期: 2023-09-27 18:09:28
全部,
我使用存储过程作为ASP的InsertCommand。净SQLDataSource:
<asp:SqlDataSource
ID="_sdsData"
runat="server"
OnInserted="_sdsData_Inserted"
ConnectionString="<%$ ConnectionStrings:_db %>"
ProviderName="<%$ ConnectionStrings:_db.ProviderName %>"
InsertCommandType="StoredProcedure"
InsertCommand="create_module">
<InsertParameters>
<asp:ControlParameter Name="_type" ControlID="_fvDataR$_ddlType" Type="String" PropertyName="SelectedItem.Value" />
<asp:SessionParameter Name="_id" SessionField="USER_ID" Type="Int32" />
<asp:Parameter Name="_code" Direction="Output" Type="String" />
</InsertParameters>
</asp:SqlDataSource>
现在一切正常,但我发现错误拼写InsertCommand
中的存储过程名称不会导致错误。在这种情况下,唯一的异常行为是返回参数_code
为空值。
是否有一种方法可以发现存储过程调用是否已成功完成?
最诚挚的问候,迈克
所有,
忘记我的问题,它只需要检查事件处理程序中的异常:
protected void _sdsData_Inserted(object sender, SqlDataSourceStatusEventArgs e)
{
if( e.Exception!=null)
// Handle the exception
}