http://bugzilla.novell.com/show_bug.cgi?id=613261
http://bugzilla.novell.com/show_bug.cgi?id=613261#c0 Summary: multiple SqlCommand.ExecuteScalar() on queries with more than one result fails to finish reader Classification: Mono Product: Mono: Class Libraries Version: SVN Platform: x86-64 OS/Version: Linux Status: NEW Severity: Normal Priority: P5 - None Component: Sys.Data.SqlClient AssignedTo: [email protected] ReportedBy: [email protected] QAContact: [email protected] Found By: --- Blocker: --- User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_3; en-us) AppleWebKit/533.16 (KHTML, like Gecko) Version/5.0 Safari/533.16 When reusing a SqlCommand and calling ExecuteScalar multiple times on a query that returns more than one result will only return results every other ExecuteScalar Reproducible: Always Steps to Reproduce: 1. open SqlClient connection 2. create command 3. set command text to something that returns more than one row 4. executescalar multiple times Actual Results: mono CondensedTestCase/bin/Debug/CondensedTestCase.exe --------------- 1 MemberId: 99 --------------- 2 MemberId: --------------- 3 MemberId: 99 >>>>>>>>>>>>>>>>>>>> --------------- 1 MemberId: --------------- 2 MemberId: 99 --------------- 3 MemberId >>>>>>>>>>>>>>>>>>>> Expected Results: mono CondensedTestCase/bin/Debug/CondensedTestCase.exe --------------- 1 MemberId: 99 --------------- 2 MemberId: 99 --------------- 3 MemberId: 99 >>>>>>>>>>>>>>>>>>>> --------------- 1 MemberId: 99 --------------- 2 MemberId: 99 --------------- 3 MemberId: 99 >>>>>>>>>>>>>>>>>>>> Here is a test case to produce the unexpected results public static void Error2() { using (SqlConnection con = new SqlConnection(connStr)) { con.Open(); var cmd = con.CreateCommand(); cmd.CommandText = "SELECT id FROM Members"; Console.WriteLine(" --------------- 1 MemberId: " + cmd.ExecuteScalar()); Console.WriteLine(" --------------- 2 MemberId: " + cmd.ExecuteScalar()); Console.WriteLine(" --------------- 3 MemberId: " + cmd.ExecuteScalar()); Console.WriteLine(" >>>>>>>>>>>>>>>>>>>>"); con.Close(); } } ----------- proposed patch that fixes output ----------- Index: System.Data.SqlClient/SqlCommand.cs =================================================================== --- System.Data.SqlClient/SqlCommand.cs (revision 158592) +++ System.Data.SqlClient/SqlCommand.cs (working copy) @@ -618,9 +618,10 @@ try { if (Connection.Tds.NextResult () && Connection.Tds.NextRow ()) result = Connection.Tds.ColumnValues[0]; + + Connection.Tds.SkipToEnd (); if (commandType == CommandType.StoredProcedure) { - Connection.Tds.SkipToEnd (); GetOutputParameters (); } } catch (TdsTimeoutException ex) { -- Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA contact for the bug. You are the assignee for the bug. _______________________________________________ mono-bugs maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-bugs
