[Mono-bugs] [Bug 75911][Nor] New - SqlDataReader.GetBytes fails on
cast exception
bugzilla-daemon at bugzilla.ximian.com
bugzilla-daemon at bugzilla.ximian.com
Fri Aug 26 16:06:35 EDT 2005
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by mike at ameripages.com.
http://bugzilla.ximian.com/show_bug.cgi?id=75911
--- shadow/75911 2005-08-26 16:06:35.000000000 -0400
+++ shadow/75911.tmp.23579 2005-08-26 16:06:35.000000000 -0400
@@ -0,0 +1,77 @@
+Bug#: 75911
+Product: Mono: Class Libraries
+Version: 1.1
+OS: Mac OS X 10.3
+OS Details: tiger
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: Sys.Data.SqlClient
+AssignedTo: mono-bugs at ximian.com
+ReportedBy: mike at ameripages.com
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: SqlDataReader.GetBytes fails on cast exception
+
+Please fill in this template when reporting a bug, unless you know what
+you are doing.
+Description of Problem:
+long hxint = hxrdr.GetBytes( 2, 0, null, 0, Int32.MaxValue);
+fails with
+System.InvalidCastException: Type is System.String in <0x00148>
+System.data.SqlClient.SqlDataREader:GetBytes ( Int32 i,Int64 dataindex,
+System.Byte[] buffer, Int32 bufferIndex, Int32 length)
+in (wrapper remoting-invoke-with-check)
+System.Data.SqlClient.SqlDataReade:GetBytes( int, long, byte[],int,int)
+
+This code succeeds on XP. There aren't any strings in sight, so
+
+Steps to reproduce the problem:
+1. retrieve a row using SequentialAccess
+2. Attempt to get length of a text field
+3.
+
+Actual Results:
+
+
+Expected Results:
+
+
+How often does this happen?
+every time
+
+Additional Information:
+
+[STAThread]
+static void Main(string[] args)
+{
+ string hx = string.Empty;
+ string attr = string.Empty;
+ SqlConnection hxconn = new SqlConnection(Common.connString);
+ hxconn.Open();
+// historyTxt is a text data type
+ SqlCommand hxcmd = new SqlCommand( "SELECT DBID, site, historyTxt
+from Sites WHERE DBID = '{FBB69203-45B9-456E-9600-5EADF44FECDF}'" ,
+hxconn);
+ SqlDataReader hxrdr = hxcmd.ExecuteReader(
+CommandBehavior.SequentialAccess );
+ bool hasrows = hxrdr.HasRows;
+ Console.WriteLine("hasrows = " + hasrows);
+ hxrdr.Read( );
+ if ( hasrows) {
+ string sitename = hxrdr.GetString(1);
+ Console.WriteLine(sitename);
+ if ( !hxrdr.IsDBNull( 2 )) {
+ Console.WriteLine("2 is not DBNULL");
+ long hxint = hxrdr.GetBytes( 2, 0, null, 0,
+Int32.MaxValue);
+ Console.WriteLine("got the len = " + hxint);
+ }
+ }
+ hxrdr.Close();
+ hxconn.Close();
+}
+}
More information about the mono-bugs
mailing list