Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / DataGrid / September 2007

Tip: Looking for answers? Try searching our database.

Unable to retrieve schema - Divide by zero error encountered

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Stephan Steiner - 17 Sep 2007 13:14 GMT
Hi

Has anybody ever come across this error when working with a DataView on
ASP.NET 2.0?

Here's the funny thing - the grid works fine. However, if I try to edit
columns, I don't have the list of all the available columns in the data
source. If I try to refresh the schema, either in the edit columns mode or
via that sqldatasource directly, I get the abovementioned error - the full
text is

Unable to retrieve schema. Ensure that the ConnectionString and
SelectCommand properties are valid.

Divide by zero error encountered.

However, if I configure the datasource, and go through the usual steps, when
I get to the point where I can test the data source, I do get the expected
results back - thus further underlining that there's nothing wrong with the
underlying connection or select command.

I even set a breakpoint in the selecting event of the sqldatasource to
ensure that the parameters sent to my stored procedure (the data source
calls a stored procedure with two arguments) are correct.

While there's a numeric division in the stored procedure, there are
precautions in the code preventing any possible division by zero, and sine
even Visual Studio manages to get the data in the data source configuration
mode, there's nothing wrong with the data that is being returned, leaving me
with the question what the heck is going on here.

Any insight you might have would be greatly appreciated. In the meantime
I've gone over to configuring the grid manually which seems to work just
fine (I have yet to see any data in the running app though.. )

Regards
Stephan
PJ - 24 Sep 2007 14:55 GMT
I had this problem with one of my stored procedures. Solution for me was
to go through it and wherever a divide by 0 could be generated, use
'nullif' to change a 0 value to a null value.

eg
Select @new = @100 / @zero

becomes

Select @new = @100 / nullif(@zero,0)

My stored procedure trapped divide by 0 via logic so it will never be
execute in a live situation and why it was generated in VS2005 is still
a mystery but this change was enough to allow vs2005 to retrieve the
schema info and populate the grid fields etc.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.