Bug 19950 - SqlDataReader::ExecuteReader() differs from Microsoft.NET
Summary: SqlDataReader::ExecuteReader() differs from Microsoft.NET
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: System.Data (show other bugs)
Version: unspecified
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2014-05-20 23:38 UTC by Christopher Pereira
Modified: 2016-04-16 09:47 UTC (History)
2 users (show)

See Also:
Is this bug a regression?: ---
Last known good build:


Description Christopher Pereira 2014-05-20 23:38:23 UTC
In Mono 2.11.4 (and other versions), SqlDataReader::ExecuteReader() is not working in the same way as Microsoft.NET.

--- Example ---

SqlConnection myConnection = new SqlConnection("user id=<user>;password=<pw>;server=<host>,<port>;database=<db>");

SqlCommand myCommand;
SqlDataReader reader;

myCommand = new SqlCommand("BEGIN TRANSACTION", myConnection);

// BUG: Doesn't work on Mono, but works on Microsoft.NET
reader = myCommand.ExecuteReader();

// OK: Works fine on Mono and Microsoft.NET
// myCommand.ExecuteNonQuery();


The same occurs for other NonQuery commands like "SET IDENTITY_INSERT <table> ON".
This is breaking MSSQL Support on Phalanger (see: https://github.com/DEVSENSE/Phalanger/issues/29)
Comment 1 Christopher Pereira 2014-05-21 00:11:56 UTC
I forgot to mention that using ExecuteReader() instead of ExecuteNonQuery() for the command "BEGIN TRANSACTION" generates the following error with Mono (not with MS.NET):

Command execution failed: Transaction count after EXECUTE indicates a mismatching number of BEGIN and COMMIT statements. Previous count = 0, current count = 1.

Note You need to log in before you can comment on or make changes to this bug.