Note that there are some explanatory texts on larger screens.

plurals
  1. POCatch SQLException from a stored procedure IN a gridview
    primarykey
    data
    text
    <p>I have a stored procedure(SP) named UPDATE_INFO, in that SP, I throw some SQLExceptions</p> <pre><code>RAISERROR ('Exception Created',16,1); </code></pre> <p>I use that SP in a girdview, now what I want is that whenever an exception is thrown, I can catch it and display it sothat the users can know what is going wrong. </p> <p>But I don't know how to do this, I think that the Gridview already catch all exceptions from SPs</p> <p>Does anyone get a way to do this?</p> <p>Code part:</p> <pre><code>&lt;asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent"&gt; &lt;asp:UpdatePanel ID="UpdatePane" runat="server"&gt; &lt;ContentTemplate &gt; &lt;asp:GridView ID="GridView" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="ProjectID" DataSourceID="DataSource" &gt; &lt;Columns&gt; &lt;asp:CommandField ShowEditButton="True" CausesValidation="false" /&gt; &lt;asp:BoundField DataField="Name" HeaderText="Name" SortExpression="ProjectID"/&gt; &lt;/Columns&gt; &lt;/asp:GridView&gt; &lt;/ContentTemplate&gt; &lt;/asp:UpdatePanel&gt; &lt;asp:SqlDataSource ID="DataSource" runat="server" ConflictDetection="CompareAllValues" ConnectionString="&lt;%$ ConnectionStrings:ConnectionString %&gt;" SelectCommand="SELECT" SelectCommandType="StoredProcedure" UpdateCommand="UPDATE" UpdateCommandType="StoredProcedure"&gt; &lt;UpdateParameters&gt; &lt;asp:Parameter Name="Name" Type="String" /&gt; &lt;asp:Parameter Name="original_Name" Type="String" /&gt; &lt;/UpdateParameters&gt; &lt;/asp:SqlDataSource&gt; &lt;/asp:Content&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload