Page 1 of 1

InsertCommand on autoincrement indexed tables

Posted: Tue 05 Apr 2011 14:10
by cluster
Hi,

I'm using the pro version of dotConnet Universal which I just purchased yesturday.
I'm trying to bind the new SQLite adapter to my project, unfotunatly with some issues.
I'm using Devart.Data.Universal.SQLite.dll version 3.20.44.0

the problem:

while using th myAdapter.InsertCommand() on a DataTable I usually set a NULL value for the index which is an autoincremental int.
I used that witch other adapters befor however this leads to a problem using the SQLite provider from DevArt.

Can you please help me finding a quik solution
thank and best regards from Germany,
cluster

Posted: Fri 08 Apr 2011 17:05
by StanislavK
Could you please specify the problem you've encountered (e.g., the message and stack trace of the exception) and the exact way you are updating the table? For example, the following code worked well in our environment:

Code: Select all

UniDataAdapter adapter = new UniDataAdapter("select id, val from test", connection);
adapter.InsertCommand = new UniCommand("insert into test values (null, :val)", connection);
adapter.InsertCommand.Parameters.Add("val", UniDbType.VarChar, 10, "val");

DataTable dt = new DataTable();
adapter.Fill(dt);

dt.Rows.Add(0, "C");
adapter.Update(dt);
Please specify what should be changed in this sample to reproduce the issue.

The table used in the sample is defined as

Code: Select all

create table test (
  id INTEGER PRIMARY KEY AUTOINCREMENT, 
  val TEXT
);