[Mono-devel-list] bug in System.Data.Common.DbDataRecord.GetValues(object[] values)

eran erand at mainsoft.com
Tue Sep 16 09:12:39 EDT 2003


Hello,
 
The method System.Data.Common.DbDataRecord.GetValues(object[] values)
doesn't put the values of the DbDataRecord into values parameter.
 
Steps to reproduce the problem:
1.	create a database (testdb) that contains table (table1) with 2
columns (ID int, NAME varchar)
        CREATE TABLE table1 (ID integer, NAME varchar(50));
   2. add some rows to the table.
 
      3. do the following code :
            SqlConnection myConnection = new
SqlConnection(connectionString);
      SqlCommand myCommand = new SqlCommand("SELECT ID, NAME FROM
table1", myConnection);
 
      myConnection.Open();
      SqlDataReader reader = myCommand.ExecuteReader();
 
      foreach (object o in reader)
      {
            System.Data.Common.DbDataRecord rec =
(System.Data.Common.DbDataRecord)o;
            object[] objs = new object[rec.FieldCount];
                        
            rec.GetValues(objs);
            Console.WriteLine("Values from GetValues(object[] values)");
            Console.WriteLine(objs[0]);
Console.WriteLine(objs[1]);
 
Console.WriteLine("Values from GetValue(int index)");
Console.WriteLine(rec.GetValue(0));
Console.WriteLine(rec.GetValue(1));
 
 
 
      }
      myConnection.Close();
 
Actual Results:
the values from GetValues(object[] values) are null, and values from
GetValue(int index) are not null.
Expected Results:
same result from GetValues(object[] values) and GetValues(int index).
Enclosed is a small test case and a patch.
Thanks a lot,
Eran Domb
 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20030916/8bd98b2d/attachment.html 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: TestCase.cs
Url: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20030916/8bd98b2d/attachment.pl 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DbDataRecord.cs.diff
Type: application/octet-stream
Size: 669 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20030916/8bd98b2d/attachment.obj 


More information about the Mono-devel-list mailing list