On 8/16/06, Shawn Wildermuth <[EMAIL PROTECTED]> wrote:
- SqlDataSources swallow errors (which is one reason I am firmly against them in all but the most RAD environments).
! I'd love to know the justification for *that* decision. "Brain-dead" doesn't *begin* to describe it. Does it equally swallow errors on inserts, updates and deletes?
- If you're sure the GetLotAttribute isn't being executed (SQL Profiler is probalby your friend here), then look at the events for the data source to get more information. If you hand the Selecting event, you can see the command before it attempts to be executed (good for checking the state of parameters).
I've been using Profiler long enough to still call it "SQL Trace" on occaision :). I'm quite sure it's not being called. After a bit of playing with the Selecting and Selected events -- good call, that -- I have the following to report: 1. The problem occurs when the parameter value is null. More specifically, if the DefaultValue is blank and ConvertEmptyStringToNull is set to true, I don't get any data. If DefaultValue is not blank, or if ConvertEmptyStringToNull is set to false, I do get data. The parameter value correctly shows as "null" in the former case, and doesn't otherwise look odd. 2. When I get data, both the Selecting and the Selected events fire. When I don't get data, Selecting fires, but Selected does not. In case you're wondering, I can call the procedure with a null value in Query Analyzer without any problem. I decided to fire up Reflector and look for the reason -- and I've found it. The static function WebControls.Parameter.GetValue returns null for an empty string instead of DbNull.Value when ConvertEmptyStringToNull" is set. Chasing back up the call stack, I get to WebControls.SqlDataSourceView.ExecuteSelect, where -- if the value of the CancelSelectOnNullParameter attribute is true and a null is returned by GetValue -- the select will simply be canceled without an error. Naturally, this attribute is set to true by default. Not terribly intuitive behavior as far as I'm concerned. -- Curt Hagenlocher [EMAIL PROTECTED] =================================== This list is hosted by DevelopMentorĀ® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com
