473,386 Members | 1,715 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Declarative use of sqlDataSource in ASP.net 2.0 and Exception Hand

I have been enjoying the declarative use of the new sqlDataSource in asp2.0.
It makes paging and query building extremely quick and simple. However
occasionally I expect to get a timeout exception. Without filling the
sqlDataSource manually I don’t know how to go about catching an exception.
(Most likely but not limited to a timeout exception) I certainly don’t want
to leave an unhandled the exception. And I would like to give a friendly
custom message to the user describing what went wrong in trying to service
their request. (I would prefer not to redirect them to a generic error
page.) I have read lots of examples of the no code configurability of the
sqlDataSource but have not seen any that demonstrated any kind of exception
handling. Does anyone know how to handle exceptions when using the
sqlDataSource control declaratively?

Thanks,
Jeff

Feb 1 '06 #1
1 1662
Hi Jeff,

Welcome to the MSDN newsgroup.

As for the SqlDataSource control you mentioned, current it dosn't contain
such a event which can capture all the exceptions raised in the
SQLDatasource's functions(like connecting , selecting or updating...).
Generally speaking to provide such a centralized event handing method, the
control should have a certain function which calls all the other sub
functions sequentially so that it can use a large try...catch... block to
wrap them. And the ASP.NET web application's Application_Error and
Page_Error event is just implemented based on this(they use try...catch...
to wrap the asp.net request's serverside pipeline or the page's executiong
function----- processRequest). For Datasource control, it dosn't have such
a function, so it's hard to provide such a centralized exception handling
event. So far if you need to capture all the unhandled exceptions could
happend on a certain data source control, we may have to use the page_error
event. However, I do agree that it's a good idea if the sqldatasource
control can expose some event or setting for controling the connecting
operation to the server, I suggest you make the request to the MSDN
feedback site:

http://lab.msdn.microsoft.com/produc...k/default.aspx

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Feb 2 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Timm | last post by:
I have an ASP.NET 2.0 page with two DropDownLists. I am using declarative data binding wherever possible and trying to minimize the use of code. The list of values in DropDownList DDL2 should be...
2
by: wubin_98 | last post by:
Hi All, Could any expert point out what is wrong in my code? I search around but couldn't found answer. It seems that I am the first person have this problem. Thanks in advanced I have a...
3
by: Victor Rodriguez | last post by:
Is it possible to add records and edit records by hand using code on a SqlDataSource and then save it on the server? thanks, Victor
4
by: Rob | last post by:
Hey all, So.. a simple FormView/SqlDataSource to handle inserting records into a table. The table has a primary key that the user enters (eg DiscountCode). If the user enters a duplicate the...
1
by: | last post by:
Is there a way to handle when you're on insert mode on a formview and the record you're about to save to the database already exist and insted you rather update instead of inserting and getting an...
0
by: ASMJ | last post by:
Hi, I have a web page where I use a sqldatasource to manipulate data in a gridview. I am using all the sqlstatements generated by the sqldatasource and I have not hand written any code. The...
3
by: Ken Cox [Microsoft MVP] | last post by:
I've been going around and around on this one. I can't believe that it is "by design" as Microsoft says. Here's the situation: In *declarative* syntax, I'm trying to create a default datetime...
20
by: Artur Siekielski | last post by:
Hi. I would like to have declarative properties in Python, ie. something like slots definitions in defclass in Common Lisp. It seems that even Java will have it, using a library (...
3
by: Mechanic | last post by:
I set up a Server 2003 R2 64-bit server to run ODP.NET.... That all works fine in 32-BIT mode except 1 thing. When I use asp:SqlDataSource tag on this machine I get this error. This application...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.