[Mono-bugs] [Bug 75593][Nor] New - odbcDataAdapter.FillSchema doesn't fill PrimaryKey

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Wed Jul 20 07:55:45 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 spek at impaq.com.pl.

http://bugzilla.ximian.com/show_bug.cgi?id=75593

--- shadow/75593	2005-07-20 07:55:44.000000000 -0400
+++ shadow/75593.tmp.5784	2005-07-20 07:55:44.000000000 -0400
@@ -0,0 +1,74 @@
+Bug#: 75593
+Product: Mono: Class Libraries
+Version: 1.1
+OS: Red Hat 9.0
+OS Details: Fedora Core
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: VB Runtime
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: spek at impaq.com.pl               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: odbcDataAdapter.FillSchema doesn't fill PrimaryKey
+
+Description of Problem:
+The PrimaryKey colelction in the DataTable object is empty when should 
+contains some entries. It seems that the odbcDataAdapter.FillSchema method 
+doesn't fill this property. 
+
+Steps to reproduce the problem:
+Create database and configure ODBC connection.
+Table:
+CREATE TABLE [EdTableName] (
+	[StoreKey] [int] NOT NULL ,
+	[BatchNo] [int] NOT NULL ,
+	[RecordType] [smallint] NOT NULL DEFAULT (31),
+	CONSTRAINT [EdPrim] PRIMARY KEY  CLUSTERED 
+	(
+		[StoreKey],
+		[BatchNo]
+	)  ON [PRIMARY] 
+
+) ON [PRIMARY]
+
+Run following program:
+
+    Dim connStr As String = "DSN=xxx;UID=xxx;PWD=xxx"
+    Dim sqlStr As String = "select * from EdTableName"
+
+    Dim conn As IDbConnection = New OdbcConnection(connStr)
+    conn.Open()
+    Dim command As IDbCommand = conn.CreateCommand()
+    command.CommandText = sqlStr
+
+    Dim dataAdapter As IDbDataAdapter = New OdbcDataAdapter
+    Dim ds As New DataSet
+    dataAdapter.SelectCommand = command
+    dataAdapter.FillSchema(ds, SchemaType.Source)
+    'dataAdapter.FillSchema(ds, SchemaType.Mapped)
+    Dim rowsFilled As Integer = dataAdapter.Fill(ds)
+
+    Dim dt As DataTable = ds.Tables(0)
+    Dim dc As DataColumn
+
+    For Each dc In dt.PrimaryKey
+      Console.WriteLine("Primary key column name: " & dc.ColumnName)
+    Next
+
+Actual Results:
+Nothing is displayed
+
+Expected Results:
+Primary key column name: StoreKey
+Primary key column name: BatchNo
+
+How often does this happen? 
+Always
+
+Additional Information:
+I found this problem in ODBC connection to SQLServer and Progress db.


More information about the mono-bugs mailing list