Am 06.03.2012 07:34, schrieb Pawl:
Hi, I


Table def:
---------
CREATE TABLE [vyroba] (
   [ID_VYROBA] INTEGER PRIMARY KEY AUTOINCREMENT,
   [vlozeno] TIMESTAMP DEFAULT (datetime('now','localtime')),
   [POPIS] TEXT NOT NULL,
   [prefix_dmc] TEXT NOT NULL,
   [kistler_prog1] INT NOT NULL,
   [kislter_prog2] INT,
   [ID_PLC_PROG] INTEGER NOT NULL REFERENCES [plc_var]([ID_PLC]),
   [ready] BOOL);


C# Load procedure:
--------------------
cb = new SQLiteCommandBuilder(sqa);
sqp = new SQLiteDataAdapter("SELECT * FROM plc_var", parent.conn);
sqp.Fill(dta_plcpop);
dta.Columns["ID_VYROBA"].AutoIncrement = true;

textEdit1.DataBindings.Add("Text", dta, "POPIS");
textEdit2.DataBindings.Add("Text", dta, "prefix_dmc");
textEdit3.DataBindings.Add("Text", dta, "kistler_prog1");
textEdit4.DataBindings.Add("Text", dta, "kislter_prog2");

//This is autoincement ID
labelControl7.DataBindings.Add("Text", dta, "ID_VYROBA");

lookUpEdit1.DataBindings.Add("EditValue", dta, "ID_PLC_PROG");
lookUpEdit1.Properties.DataSource = dta_plcpop;
lookUpEdit1.Properties.DisplayMember = "popis";
lookUpEdit1.Properties.ValueMember = "ID_PLC";
lookUpEdit1.Properties.Columns.Add(new
DevExpress.XtraEditors.Controls.LookUpColumnInfo("popis",-1,""));

sqa.UpdateCommand = cb.GetUpdateCommand();
sqa.InsertCommand = cb.GetInsertCommand();
sqa.InsertCommand.CommandText += "; SELECT last_insert_rowid()";
//cb.RefreshSchema();
sqa.InsertCommand.UpdatedRowSource = UpdateRowSource.FirstReturnedRecord;

// Get current Rowposition
cm = (CurrencyManager)this.BindingContext[dta];
cm.AddNew();

dataGridView1.DataSource = dta;

Button even:
-------------

cm.EndCurrentEdit();
sqa.Update(dta);
cm.Refresh();

//Autoincrement ID have still value 0

Where is problem?

Just a guess: I don't see any Commit or surrounding Transaction.
--
Christoph

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to