Re: [sqlite] Retrieve INTEGER PRIMARY KEY

2017-02-08 Thread Clyde Eisenbeis
I have a solution, thanks to Alex Smith. This works: sqliteCmd.CommandText = "INSERT INTO " System.Data.SQLite.SQLiteTransaction sqliteTran = sqliteConnection.BeginTransaction(); sqliteCmd.ExecuteNonQuery(); long lKeyID = sqliteConnection.LastInsertRowId; sqliteTran.C

Re: [sqlite] Retrieve INTEGER PRIMARY KEY

2017-02-07 Thread Kevin Benson
On Tue, Feb 7, 2017 at 4:11 PM, Clyde Eisenbeis wrote: > int iKeyID = (int)sqliteCmd.ExecuteScalar(); > I believe the type of last_insert_rowid() is *always* INT64 -- -- -- --Ö¿Ö-- K e V i N ___ sqlite-users mailing list sqli

Re: [sqlite] Retrieve INTEGER PRIMARY KEY

2017-02-07 Thread Joe Mistachkin
Clyde Eisenbeis wrote: > > using (System.Data.SQLite.SQLiteConnection sqliteConnection = new > System.Data.SQLite.SQLiteConnection("Data Source=" + stPathFilename + > ";")) { > using (System.Data.SQLite.SQLiteCommand sqliteCmd = > sqliteConnection.CreateCommand()) { > ... > sqliteC

Re: [sqlite] Retrieve INTEGER PRIMARY KEY

2017-02-07 Thread Clyde Eisenbeis
that your statement inserts exactly one >> record and that nothing is executed on your connection between the insert >> and the call. >> > >> > -Ursprüngliche Nachricht----- >> > Von: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org

Re: [sqlite] Retrieve INTEGER PRIMARY KEY

2017-02-06 Thread Chris Locke
e-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] > Im Auftrag von Chris Locke > > Gesendet: Freitag, 03. Februar 2017 15:41 > > An: SQLite mailing list > > Betreff: Re: [sqlite] Retrieve INTEGER PRIMARY KEY > > > > Last_insert_rowid() > > > >

Re: [sqlite] Retrieve INTEGER PRIMARY KEY

2017-02-06 Thread Clyde Eisenbeis
I'm writing WPF / C# code. This is part of a function that is called whenever the user enters data that is saved. The primary key is used whenever the user changes that record ... to ensure the correct data is changed. On Mon, Feb 6, 2017 at 10:11 AM, Simon Slavin wrote: > > On 6 Feb 2017, at 1

Re: [sqlite] Retrieve INTEGER PRIMARY KEY

2017-02-06 Thread Simon Slavin
On 6 Feb 2017, at 1:30pm, Clyde Eisenbeis wrote: > What is the correct nomenclature for using last_insert_rowid() for > SQLite? For OLE DB I've used ... oledbCmd.CommandText = "Select > @@Identity" ... int iKeyID = (int)oledbCmd.ExecuteScalar(). last_insert_row() is an SQL variable. In whatev

Re: [sqlite] Retrieve INTEGER PRIMARY KEY

2017-02-06 Thread Clyde Eisenbeis
What is the correct nomenclature for using last_insert_rowid() for SQLite? For OLE DB I've used ... oledbCmd.CommandText = "Select @@Identity" ... int iKeyID = (int)oledbCmd.ExecuteScalar(). On Mon, Feb 6, 2017 at 7:24 AM, Clemens Ladisch wrote: > Clyde Eisenbeis wrote: >> Perhaps there is no eq

Re: [sqlite] Retrieve INTEGER PRIMARY KEY

2017-02-06 Thread Hick Gunter
There is no record locking in SQLite -Ursprüngliche Nachricht- Von: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] Im Auftrag von Clyde Eisenbeis Gesendet: Montag, 06. Februar 2017 14:19 An: SQLite mailing list Betreff: Re: [sqlite] Retrieve INTEGER PRIMARY KEY In

Re: [sqlite] Retrieve INTEGER PRIMARY KEY

2017-02-06 Thread Clemens Ladisch
Clyde Eisenbeis wrote: > Perhaps there is no equivalence to OLE DB ... oledbCmd.CommandText = > "Select @@Identity" ... int iKeyID = (int)oledbCmd.ExecuteScalar()? This has *nothing* to do with OLE DB; @@Identity is an SQL Server specific thing. SQLite's is last_insert_rowid(), and both have exac

Re: [sqlite] Retrieve INTEGER PRIMARY KEY

2017-02-06 Thread Clyde Eisenbeis
and the > call. > > -Ursprüngliche Nachricht- > Von: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] Im > Auftrag von Chris Locke > Gesendet: Freitag, 03. Februar 2017 15:41 > An: SQLite mailing list > Betreff: Re: [sqlite] Retrieve INTEGER PRIMA

Re: [sqlite] Retrieve INTEGER PRIMARY KEY

2017-02-06 Thread Olivier Mascia
> Le 5 févr. 2017 à 18:26, Clyde Eisenbeis a écrit : > > To clarify further, the SQLite function is attached. Attachments to this mailing list are stripped. Better inline in the email itself if short or send privately to the recipient. :) -- Best Regards, Meilleures salutations, Met vriendeli

Re: [sqlite] Retrieve INTEGER PRIMARY KEY

2017-02-06 Thread Clyde Eisenbeis
To clarify further, the SQLite function is attached. Retrieving the primary key is commented (used by System.Data.OleDb function). On Sun, Feb 5, 2017 at 10:40 AM, J Decker wrote: > http://data.sqlite.org/c3ref/last_insert_rowid.html > > there is an api call to get it; or you can use select and

Re: [sqlite] Retrieve INTEGER PRIMARY KEY

2017-02-05 Thread Hick Gunter
Gesendet: Freitag, 03. Februar 2017 15:41 An: SQLite mailing list Betreff: Re: [sqlite] Retrieve INTEGER PRIMARY KEY Last_insert_rowid() https://www.sqlite.org/c3ref/last_insert_rowid.html On Fri, Feb 3, 2017 at 1:51 PM, Clyde Eisenbeis wrote: > For OLE DB SQL, I have retrieved the primary

Re: [sqlite] Retrieve INTEGER PRIMARY KEY

2017-02-05 Thread J Decker
http://data.sqlite.org/c3ref/last_insert_rowid.html there is an api call to get it; or you can use select and get it the .net library has it as a connection property LastInsertRowId https://www.crestron.com/reference/simpl_sharp/html/P_Crestron_SimplSharp_SQLite_SQLiteConnection_LastInsertR

Re: [sqlite] Retrieve INTEGER PRIMARY KEY

2017-02-05 Thread Simon Slavin
On 5 Feb 2017, at 1:26pm, Clyde Eisenbeis wrote: > The compiler complains about "SELECT last_insert_rowid()" ... which > appears to be limited to SQLite3. The compiler should never have got that string. The string is executed when the program is already compiled, just like any other SELECT co

Re: [sqlite] Retrieve INTEGER PRIMARY KEY

2017-02-05 Thread Clyde Eisenbeis
The compiler complains about "SELECT last_insert_rowid()" ... which appears to be limited to SQLite3. Perhaps I'm missing something? On Sat, Feb 4, 2017 at 10:28 AM, Wolfgang Enzinger wrote: > Am Sat, 4 Feb 2017 09:04:58 -0600 schrieb Clyde Eisenbeis: > >> When I enter last_insert_rowid(), the c

Re: [sqlite] Retrieve INTEGER PRIMARY KEY

2017-02-04 Thread Wolfgang Enzinger
Am Sat, 4 Feb 2017 09:04:58 -0600 schrieb Clyde Eisenbeis: > When I enter last_insert_rowid(), the compiler complains. I think > last_insert_rowid() is SQLite3. > > Is there an equivalent for System.Data.SQLite? I don't know, but you can use the SQL function of the same name: https://www.sqlite

Re: [sqlite] Retrieve INTEGER PRIMARY KEY

2017-02-04 Thread Clyde Eisenbeis
When I enter last_insert_rowid(), the compiler complains. I think last_insert_rowid() is SQLite3. Is there an equivalent for System.Data.SQLite? On Fri, Feb 3, 2017 at 8:40 AM, Chris Locke wrote: > Last_insert_rowid() > > https://www.sqlite.org/c3ref/last_insert_rowid.html > > On Fri, Feb 3,

Re: [sqlite] Retrieve INTEGER PRIMARY KEY

2017-02-03 Thread Chris Locke
Last_insert_rowid() https://www.sqlite.org/c3ref/last_insert_rowid.html On Fri, Feb 3, 2017 at 1:51 PM, Clyde Eisenbeis wrote: > For OLE DB SQL, I have retrieved the primary key: > > - > using (System.Data.OleDb.OleDbConnection oledbConnect = new > System.Data.OleD

[sqlite] Retrieve INTEGER PRIMARY KEY

2017-02-03 Thread Clyde Eisenbeis
For OLE DB SQL, I have retrieved the primary key: - using (System.Data.OleDb.OleDbConnection oledbConnect = new System.Data.OleDb.OleDbConnection(stConnectString)) { using (System.Data.OleDb.OleDbCommand oledbCmd = oledbConnect.CreateCommand()) { ...