You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi everyone, and sorry for my english in advance....
I work for a financial institution and we have a system developed in VB.NET .NET Framework 4.6.1 working with Sybase ASE 12.5.4 (Adaptive Server Enterprise/12.5.4/EBF 13387/P/NT).
I've been trying out this library and now it seems pretty stable, especially on managing asynchronous processing, so I'm planning to replace the current Sybase.AdoNet45.AseClient.dll with this one.
But I came to an exception which I did not have on Sybase.AdoNet45.AseClient.dll. This happens when using a AseDataAdapter and AseCommandBuilder to INSERT/UPDATE a table wich has no primary key, but does have a unique index.
Debugging the soruce, it ends in this method: GetSchemaTableWithKeyInfo:
throw new MissingPrimaryKeyException("Cannot generate SQL statements if there is no unique column in the source command.");
The table script which I intend to INSERT is this:
CREATE TABLE dbo.ODEBIN (
ODB_FECNEG datetime NOT NULL,
ODB_NROLOG decimal(12,0) NOT NULL,
ODB_TIPOBJ varchar(5) NOT NULL,
ODB_IDEBIN varchar(22) NOT NULL,
ODB_TIPMOV varchar(1) NOT NULL,
ODB_FECORI datetime NOT NULL,
ODB_TIMORI decimal(6,0) NOT NULL,
ODB_CODIMP varchar(1) NOT NULL,
ODB_ORITRX varchar(40) NOT NULL,
ODB_ORITER varchar(10) NOT NULL,
ODB_ORIADI varchar(10) NOT NULL,
ODB_CBU char(22) NOT NULL,
ODB_CUENTA decimal(15,0) NOT NULL,
ODB_ORDEN decimal(15,0) NOT NULL,
ODB_TIPCTA decimal(5,0) NOT NULL,
ODB_SUCURS decimal(5,0) NOT NULL,
ODB_MONEDA decimal(5,0) NOT NULL,
ODB_CUIT decimal(11,0) NOT NULL,
ODB_IMPORT decimal(13,2) NOT NULL,
ODB_FECPRO datetime NOT NULL,
ODB_ESTADO smallint NOT NULL
)
ON [default]
GO
CREATE UNIQUE NONCLUSTERED INDEX X_ODB_NRLOG
ON dbo.ODEBIN(ODB_NROLOG)
ON [default]
GO
Creating primary keys is not an option. Do you think you can reproduce my case ? Or should I provide more information ?
Thanks in advance
Best regards
The text was updated successfully, but these errors were encountered:
Below is a sample code to reproduce the case. Create the following table in the database:
CREATE TABLE TBTEST(Field1 INT,
Field2 VARCHAR(20))
CREATE UNIQUE INDEX IXTB_TEST ON TBTEST(Field1)
The following VB.NET code produces the exception:
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim oCommand As New AseCommand
Dim dsTemp As DataSet
Dim oRow As DataRow
Dim daTemp As AseDataAdapter
Dim cbTemp As AseCommandBuilder
Try
oCommand.Connection = oConn
oCommand.CommandText = "SELECT * FROM TBTEST WHERE 1 = 0"
daTemp = New AseDataAdapter(oCommand)
dsTemp = New DataSet
daTemp.Fill(dsTemp)
cbTemp = New AseCommandBuilder(daTemp)
oRow = dsTemp.Tables(0).NewRow
oRow("Field1") = 1
oRow("Field2") = "Hello world"
dsTemp.Tables(0).Rows.Add(oRow)
daTemp.Update(dsTemp)
dsTemp.AcceptChanges()
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
Really don't know why.... But if intended behaviour is like Sybase.AdoNet45.AseClient.dll it should be fixed.
The exception has logic if the table has no indexes, but this is not the case...
Hi everyone, and sorry for my english in advance....
I work for a financial institution and we have a system developed in VB.NET .NET Framework 4.6.1 working with Sybase ASE 12.5.4 (Adaptive Server Enterprise/12.5.4/EBF 13387/P/NT).
I've been trying out this library and now it seems pretty stable, especially on managing asynchronous processing, so I'm planning to replace the current Sybase.AdoNet45.AseClient.dll with this one.
But I came to an exception which I did not have on Sybase.AdoNet45.AseClient.dll. This happens when using a AseDataAdapter and AseCommandBuilder to INSERT/UPDATE a table wich has no primary key, but does have a unique index.
Debugging the soruce, it ends in this method: GetSchemaTableWithKeyInfo:
throw new MissingPrimaryKeyException("Cannot generate SQL statements if there is no unique column in the source command.");
The table script which I intend to INSERT is this:
Creating primary keys is not an option. Do you think you can reproduce my case ? Or should I provide more information ?
Thanks in advance
Best regards
The text was updated successfully, but these errors were encountered: