Solved

view thrown exception

Posted on 2004-04-06
3
336 Views
Last Modified: 2012-06-27
Well, difficult to me anyway. I'm stepping through someone elses code in a dotnet app. A DLL is called further downstream, where the below shown procedure is executed. There is an error being thrown, but I cannot seem view the error. The Connection is opened, but the Fill seems to fail. I cannot modify the DLL to view the exception and a console.writeline inserted prior to the throw won't work.

    Public Function Fill(ByVal DataSetAdapter As SqlClient.SqlDataAdapter, ByVal dataset As DataSet) As Integer
        Try
            OpenConnection()
            DataSetAdapter.SelectCommand.Connection = cn
            Fill = DataSetAdapter.Fill(dataset)
        Catch ex As Exception
            Throw New ISCException(ex)
        Finally
            CloseConnection()        
        End Try
0
Comment
Question by:thefunnydad
3 Comments
 
LVL 28

Expert Comment

by:iboutchkine
ID: 10766406
First of all your function Fill is an Integer datatype

the line
            Fill = DataSetAdapter.Fill(dataset)

will return dataset, which you are trying to assign to integer. I think that is causing the problem

I would've define function asd dataset and then
instead of
 Fill = DataSetAdapter.Fill(dataset)
 use
DataSetAdapter.Fill(dataset)
Return
0
 
LVL 37

Accepted Solution

by:
gregoryyoung earned 250 total points
ID: 10779473
umm ...

Fill returns the # of rows ...
from MSDN
"Return Value
The number of rows successfully added to or refreshed in the DataSet. This does not include rows affected by statements that do not return rows.
"

from looking at the code I would guess that the ISCException is using the exception as its innerexception although it may not be . I would need to see the code for ISCexception to be sure.

If you have access to this code (which it sounds like you do ...) set a break point on the throw ... then in the command window type "? ex" when it hits ... it will dump the original exception.

I would also take a look at the exception class to see what he might be doing with the original exception for future use.

Greg
0
 

Author Comment

by:thefunnydad
ID: 10790983
Issue was a little more protracted; but you were closest Greg. ISCException was throwing the exception because there was an issue with the connection paramters being passed. I found this by accident however; I did not code the ISCException handler, but it would havemore beneficial to me if the Throw had returned the error to some place where I coud see it.


Thanks for the help(s)

Regards,

Scott
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It seems a simple enough task, yet I see repeated questions asking how to do it: how to pass data between two forms. In this article, I will show you the different mechanisms available for you to do just that. This article is directed towards the .N…
This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question