473,387 Members | 1,742 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,387 software developers and data experts.

Debugging into SqlCommand.ExecuteReader

Does anyone know if there are any articles explaining how
I could debug into SqlCommand.ExecuteReader so I can see
why I am getting a particular error.

thanks
Nov 15 '05 #1
6 8738
What error are you getting?

"BuddyWork" <an*******@discussions.microsoft.com> wrote in message
news:22****************************@phx.gbl...
Does anyone know if there are any articles explaining how
I could debug into SqlCommand.ExecuteReader so I can see
why I am getting a particular error.

thanks

Nov 15 '05 #2
Hi,

I don;t think that it's possible, as you don;t have the source code for it
or its being compiled with debug info the only way is to debug the IL code
:)
Anyway, I don't really think that it's necessary, I would suggest you to
post the problem you have and maybe it's possible to help you without need
to decompile ExecuteReader() :)

Cheeers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"BuddyWork" <an*******@discussions.microsoft.com> wrote in message
news:22****************************@phx.gbl...
Does anyone know if there are any articles explaining how
I could debug into SqlCommand.ExecuteReader so I can see
why I am getting a particular error.

thanks

Nov 15 '05 #3
Hello,

The problem is that when using SqlCommand.ExecuteReader
and the SQL statement raises an error of severity of 16
then ExecuteReader throws an exception, when you use
OdbcCommand.ExecuteReader the exception is not raised but
when you call Read() method of the OdbcDataReader you then
get the exception which is correct, basically SqlClient
does not let you call the Read method, the main problem is
that if run a Sql statement of say
'Need to create the following SP first.
create proc test
as
rollback tran
go

now run the following SQL through SqlCommand and then
OdbcCommand
begin tran
execute test
select hello="World"

you will notice that SqlCommand throws an exception on
ExecuteReader function where OdbcCommand does not, so Odbc
allows you to call Read and NextResult to go through the
recordset and retrieve your data, wher SqlClient does not
because you don't get the SqlDataReader object back.

Thanks,
-----Original Message-----
Hi,

I don;t think that it's possible, as you don;t have the source code for itor its being compiled with debug info the only way is to debug the IL code:)
Anyway, I don't really think that it's necessary, I would suggest you topost the problem you have and maybe it's possible to help you without needto decompile ExecuteReader() :)

Cheeers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"BuddyWork" <an*******@discussions.microsoft.com> wrote in messagenews:22****************************@phx.gbl...
Does anyone know if there are any articles explaining how I could debug into SqlCommand.ExecuteReader so I can see
why I am getting a particular error.

thanks

.

Nov 15 '05 #4
Hello,

The problem is that when using SqlCommand.ExecuteReader
and the SQL statement raises an error of severity of 16
then ExecuteReader throws an exception, when you use
OdbcCommand.ExecuteReader the exception is not raised but
when you call Read() method of the OdbcDataReader you then
get the exception which is correct, basically SqlClient
does not let you call the Read method, the main problem is
that if run a Sql statement of say
'Need to create the following SP first.
create proc test
as
rollback tran
go

now run the following SQL through SqlCommand and then
OdbcCommand
begin tran
execute test
select hello="World"

you will notice that SqlCommand throws an exception on
ExecuteReader function where OdbcCommand does not, so Odbc
allows you to call Read and NextResult to go through the
recordset and retrieve your data, wher SqlClient does not
because you don't get the SqlDataReader object back.

Thanks,
-----Original Message-----
What error are you getting?

"BuddyWork" <an*******@discussions.microsoft.com> wrote in messagenews:22****************************@phx.gbl...
Does anyone know if there are any articles explaining how I could debug into SqlCommand.ExecuteReader so I can see
why I am getting a particular error.

thanks

.

Nov 15 '05 #5
From the documentation:
"Error messages with a severity level of 10 are informational. Error
messages with severity levels from 11 through 16 are generated by the user
and can be corrected by the user"

executing test store procedure will give you error of severity 16,
"Server: Msg 3903, Level 16, State 1, Procedure test, Line 3
The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION."

so you cannot issue 'rollback' statement without preceding 'begin tran'.

"BuddyWork" <an*******@discussions.microsoft.com> wrote in message
news:27****************************@phx.gbl...
Hello,

The problem is that when using SqlCommand.ExecuteReader
and the SQL statement raises an error of severity of 16
then ExecuteReader throws an exception, when you use
OdbcCommand.ExecuteReader the exception is not raised but
when you call Read() method of the OdbcDataReader you then
get the exception which is correct, basically SqlClient
does not let you call the Read method, the main problem is
that if run a Sql statement of say
'Need to create the following SP first.
create proc test
as
rollback tran
go

now run the following SQL through SqlCommand and then
OdbcCommand
begin tran
execute test
select hello="World"

you will notice that SqlCommand throws an exception on
ExecuteReader function where OdbcCommand does not, so Odbc
allows you to call Read and NextResult to go through the
recordset and retrieve your data, wher SqlClient does not
because you don't get the SqlDataReader object back.

Thanks,
-----Original Message-----
What error are you getting?

"BuddyWork" <an*******@discussions.microsoft.com> wrote

in message
news:22****************************@phx.gbl...
Does anyone know if there are any articles explaining how I could debug into SqlCommand.ExecuteReader so I can see
why I am getting a particular error.

thanks

.

Nov 15 '05 #6
Thanks for the reply,

But I don't think you understood my question, basically
the problem is that Odbc.ExecuteReader does NOT THROW AN
EXCEPTION whereas SqlClient.ExecuteReader does THROW AN
EXCEPTION, so because SqlClient.ExecuteReader THROWS AN
EXCEPTION there is NO WAY of retrieving the SqlDataReader
object which then means you CANNOT go through the
recordset for each MULTIPLE results returned, I've looked
at the IL code of SqlClient and can see that data is there
but SqlClient refuses you to get to it, when Odbc.Net
allows you to access the data. Please note that Odbc.Net
THROWS THE EXCEPTION when calling the READ or NEXTRESULT
method of the OdbcDataReader object.

THIS IS A BUG IN THERE CODE.

Thanks
-----Original Message-----
From the documentation:
"Error messages with a severity level of 10 are informational. Errormessages with severity levels from 11 through 16 are generated by the userand can be corrected by the user"

executing test store procedure will give you error of severity 16,"Server: Msg 3903, Level 16, State 1, Procedure test, Line 3The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION."
so you cannot issue 'rollback' statement without preceding 'begin tran'.
"BuddyWork" <an*******@discussions.microsoft.com> wrote in messagenews:27****************************@phx.gbl...
Hello,

The problem is that when using SqlCommand.ExecuteReader
and the SQL statement raises an error of severity of 16
then ExecuteReader throws an exception, when you use
OdbcCommand.ExecuteReader the exception is not raised but when you call Read() method of the OdbcDataReader you then get the exception which is correct, basically SqlClient
does not let you call the Read method, the main problem is that if run a Sql statement of say
'Need to create the following SP first.
create proc test
as
rollback tran
go

now run the following SQL through SqlCommand and then
OdbcCommand
begin tran
execute test
select hello="World"

you will notice that SqlCommand throws an exception on
ExecuteReader function where OdbcCommand does not, so Odbc allows you to call Read and NextResult to go through the
recordset and retrieve your data, wher SqlClient does not because you don't get the SqlDataReader object back.

Thanks,
>-----Original Message-----
>What error are you getting?
>
>"BuddyWork" <an*******@discussions.microsoft.com> wrote

in message
>news:22****************************@phx.gbl...
>> Does anyone know if there are any articles explaining

how
>> I could debug into SqlCommand.ExecuteReader so I can see >> why I am getting a particular error.
>>
>> thanks
>
>
>.
>

.

Nov 15 '05 #7

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

Similar topics

1
by: Donnie Darko | last post by:
I'm trying to understand SqlConnection(), SqlCommand() For example. I use SqlConnection() as a parameter when I create a new SqlCommand. Then I open SqlConnection(), then I execute the...
10
by: Henrik Dahl | last post by:
Hello! After I've finished using an instance of the SqlCommand class, should I then invoke Dispose() on the instance. I suppose so, as there is a Dispose method, but what does it actually...
10
by: CD | last post by:
Hi, I'm very new to C# and am working on using a stored procedure to MSSQL with two date parameters. The first problem I'm having is that SQL appears to be throwing an exception (or my parameters...
1
by: Tom | last post by:
Hello guys Please have a look on following paragraph from ".NET Data Access Architecture Guide". ''''''''''' Although you can repeatedly use the same SqlCommand object to execute the same...
3
by: Jason Huang | last post by:
Hi, In C#.Net, can we have more than one SqlCommand in a SqlConnection? And in one SqlCommand, can we have more than one SqlDataReader in a SqlCommand? In what situation should I use...
2
by: Jason Huang | last post by:
Hi, In my codes: ======================================= myConn.Open(); SqlTransaction MyTrans= myConn.BeginTransaction(); SqlCommand myCommand = new SqlCommand("ZZZ15UserLog",myConn);...
0
by: =?Utf-8?B?ZGF2ZQ==?= | last post by:
The following finishes in 1 hour instead of erroring after 1 second as expected. Dim cn As New System.Data.SqlClient.SqlConnection cn.ConnectionString = "Server=(local); Database=master; User...
2
by: SunshineInTheRain | last post by:
I'm trying to modify a long long code within a button click by make the insert/update/delete/select using the same transaction. Purpose is to make sure every operation can be rollback instead of some...
3
by: jeenajos | last post by:
Hi all, I had used a sqlquery in sqlcommand for retrieving the tablename that is entered by the user thru a textbox. Using that tablename.It should display the records in that tablename. But one...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.