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 [EMAIL PROTECTED] http://bugzilla.ximian.com/show_bug.cgi?id=75599 --- shadow/75599 2005-07-21 08:19:16.000000000 -0400 +++ shadow/75599.tmp.17819 2005-07-21 08:19:16.000000000 -0400 @@ -0,0 +1,112 @@ +Bug#: 75599 +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: [EMAIL PROTECTED] +ReportedBy: [EMAIL PROTECTED] +QAContact: [EMAIL PROTECTED] +TargetMilestone: --- +URL: +Cc: +Summary: odbcDataAdapter.Update throws an exception + +Description of Problem: +After adding new row in the DataTable object and calling the +odbcDataAdapter.Update method the exception is thrown but new row is added +to the databse. + +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: +Sub Main() + Dim connStr As String = "DSN=xxx;UID=xxx;PWD=xxx" + Dim sqlStr As String = "select * from EdTableName" + Dim insertSql As String = "insert into EdTableName (StoreKey, BatchNo, +RecordType) values (?, ?, ?)" + + Dim conn As IDbConnection = New OdbcConnection(connStr) + conn.Open() + Dim command As IDbCommand = conn.CreateCommand() + command.CommandText = sqlStr + + 'insert command + Dim insertCommand As IDbCommand = conn.CreateCommand + insertCommand.CommandText = insertSql + Dim parStoreKey As OdbcParameter = command.CreateParameter() + Dim parBatchNo As OdbcParameter = command.CreateParameter() + Dim parRecordType As OdbcParameter = command.CreateParameter() + CreateODBCParameter(parStoreKey, insertCommand, "StoreKey", +OdbcType.Int) + CreateODBCParameter(parBatchNo, insertCommand, "BatchNo", OdbcType.Int) + CreateODBCParameter(parRecordType, insertCommand, "RecordType", +OdbcType.SmallInt) + + + Dim dataAdapter As IDbDataAdapter = New OdbcDataAdapter + dataAdapter.SelectCommand = command + dataAdapter.InsertCommand = insertCommand + + Dim ds As New DataSet + dataAdapter.FillSchema(ds, SchemaType.Source) + dataAdapter.Fill(ds) + + Dim dt As DataTable + dt = ds.Tables(0) + + Dim dr As DataRow = dt.NewRow() + With dr + .Item("StoreKey") = 1 + .Item("BatchNo") = 10 + .Item("RecordType") = 1 + .EndEdit() + End With + dt.Rows.Add(dr) + + dataAdapter.Update(dt.DataSet) + dt.AcceptChanges() + End Sub + + Private Sub CreateODBCParameter(ByRef par As OdbcParameter, ByRef +command As IDbCommand, _ + ByVal colName As String, ByVal parType As OdbcType) + par.SourceColumn = colName + par.ParameterName = "?" + par.OdbcType = parType + par.Direction = ParameterDirection.Input + par.SourceVersion = DataRowVersion.Current + command.Parameters.Add(par) + End Sub +Actual Results: +Unhandled Exception: System.NotImplementedException: The requested feature +is not implemented. +in <0x0001d> System.Data.Odbc.OdbcCommand:get_UpdatedRowSource () +in <0x008f2> System.Data.Common.DbDataAdapter:Update (System.Data.DataRow +[] dataRows, System.Data.Common.DataT +ableMapping tableMapping) + +Expected Results: + + +How often does this happen? +Always when using parametrised insert command. + +Additional Information: _______________________________________________ mono-bugs maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-bugs
