|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
sqldatasource and connection exception handlingHi,
In my page, I'm using a gridview and a sqldatasource. I don't know how to handle the exception that occurs when the database server is unavailable. I've read that I should use the execption property of the selected event. But for this exception, the property is null. How can I handle this exception ? Thanks, Loïc I tried to replicate the problem and I'm getting the correct behavior-
the exception property is set. Are you sure you're wiring up the correct event? //code behind protected void SqlDataSource1_Selected(object sender, SqlDataSourceStatusEventArgs e) { string s = e.Exception.Message; } //page <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="..." SelectCommandType="StoredProcedure" OnSelected="SqlDataSource1_Selected"> Loic Transler wrote: Show quoteHide quote > Hi, > > In my page, I'm using a gridview and a sqldatasource. I don't know how to > handle the exception that occurs when the database server is unavailable. > I've read that I should use the execption property of the selected event. > > But for this exception, the property is null. > > How can I handle this exception ? > > > Thanks, > > Loïc Hum... I realized that I was not working on the good sqldatasource... Sorry.
Thank you Loïc Show quoteHide quote "Michael Hamrah" wrote: > I tried to replicate the problem and I'm getting the correct behavior- > the exception property is set. Are you sure you're wiring up the > correct event? > > //code behind > protected void SqlDataSource1_Selected(object sender, > SqlDataSourceStatusEventArgs e) > { > string s = e.Exception.Message; > } > > //page > <asp:SqlDataSource ID="SqlDataSource1" runat="server" > ConnectionString="<%$ ConnectionStrings:ConnectionString %>" > SelectCommand="..." SelectCommandType="StoredProcedure" > OnSelected="SqlDataSource1_Selected"> > > > Loic Transler wrote: > > Hi, > > > > In my page, I'm using a gridview and a sqldatasource. I don't know how to > > handle the exception that occurs when the database server is unavailable. > > I've read that I should use the execption property of the selected event. > > > > But for this exception, the property is null. > > > > How can I handle this exception ? > > > > > > Thanks, > > > > Loïc > >
how to map the given name to different domain
what' wrong with this? Design View when using an ASP:Panel to show/hide groups of <tr>'s FormView problem with Templates and Tables Turning URL Navigation off on a Treeview IConvertible Error IE-7 ITemplate web parts bug? DataSource failing with null integer parameter |
|||||||||||||||||||||||