[Mono-bugs] [Bug 70048][Nor] New - Cannot fill a dataset using OdbcDataAdapter
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Tue, 30 Nov 2004 16:04:06 -0500 (EST)
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 jlacour@optiosoftware.com.
http://bugzilla.ximian.com/show_bug.cgi?id=70048
--- shadow/70048 2004-11-30 16:04:06.000000000 -0500
+++ shadow/70048.tmp.19803 2004-11-30 16:04:06.000000000 -0500
@@ -0,0 +1,103 @@
+Bug#: 70048
+Product: Mono: Class Libraries
+Version: 1.0
+OS: SUSE 9.1
+OS Details:
+Status: NEW
+Resolution:
+Severity: Unknown
+Priority: Normal
+Component: Sys.Data
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: jlacour@optiosoftware.com
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Cannot fill a dataset using OdbcDataAdapter
+
+Description of Problem:
+
+I have a ODBC data source (a recent postgres database) setup using unixODBC
+2.2.8. I can connect to this data source using isql on the command line
+and by connecting to it using OdbcConnection. I can perform queries
+successfully using IDbCommand and the normal method.
+
+However, I cannot perform the same query and fill a DataSet using
+OdbcDataAdapter.
+
+Steps to reproduce the problem:
+
+Here are my two test programs. The first one works fine, the second one
+does not:
+
+/* THIS EXAMPLE WORKS */
+using System;
+using System.Data;
+using System.Data.Odbc;
+
+public class Test
+{
+
+ public static void Main(string[] args)
+ {
+ string connectionString = "DSN=PostgreSQL;";
+ IDbConnection dbcon = new OdbcConnection(connectionString);
+ dbcon.Open();
+ IDbCommand dbcmd = dbcon.CreateCommand();
+
+ string sql = "select personname from people";
+ dbcmd.CommandText = sql;
+ IDataReader reader = dbcmd.ExecuteReader();
+ while (reader.Read())
+ {
+ string personName = (string) reader["personname"];
+ Console.WriteLine(personName);
+ }
+
+ reader.Close();
+ reader = null;
+ dbcmd.Dispose();
+ dbcmd = null;
+ dbcon.Close();
+ dbcon = null;
+ }
+}
+
+
+/* THIS EXAMPLE DOES NOT WORK */
+using System;
+using System.Data;
+using System.Data.Odbc;
+
+public class Test {
+
+ public static void Main(string[] args) {
+ string connectionString = "DSN=PostgreSQL;";
+ OdbcDataAdapter adapter = new OdbcDataAdapter(
+ "select * from people",
+ connectionString
+ );
+
+ DataSet ds = new DataSet("people");
+ adapter.Fill(ds, "people");
+
+ foreach (DataRow row in ds.Tables[0].Rows) {
+ Console.WriteLine(row["personname"]);
+ }
+ }
+}
+
+
+/* THIS IS THE EXCEPTION THAT IS THROWN */
+Unhandled Exception: System.Data.Odbc.OdbcException: Unable to retreive
+error information from ODBC driver manager
+in <0x00135> System.Data.Odbc.OdbcDataReader:Close ()
+in <0x00221> System.Data.Common.DbDataAdapter:Fill
+(System.Data.DataSet,string,System.Data.IDataReader,int,int)
+in <0x000da> System.Data.Common.DbDataAdapter:Fill
+(System.Data.DataSet,int,int,string,System.Data.IDbCommand,System.Data.CommandBehavior)
+in <0x00049> System.Data.Common.DbDataAdapter:Fill (System.Data.DataSet,string)
+in <0x0006b> (wrapper remoting-invoke-with-check)
+System.Data.Common.DbDataAdapter:Fill (System.Data.DataSet,string)
+in <0x00086> Test:Main (string[])