Re: [sqlite] How to check if a record exists

2014-11-05 Thread Drago, William @ CSG - NARDAEAST
; From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users- > boun...@sqlite.org] On Behalf Of James K. Lowden > Sent: Tuesday, November 04, 2014 6:23 PM > To: sqlite-users@sqlite.org > Subject: Re: [sqlite] How to check if a record exists > > On Tue, 4 Nov 2014 21:47:20 +

Re: [sqlite] How to check if a record exists

2014-11-05 Thread Drago, William @ CSG - NARDAEAST
te.org [mailto:sqlite-users- > boun...@sqlite.org] On Behalf Of Igor Tandetnik > Sent: Tuesday, November 04, 2014 5:49 PM > To: sqlite-users@sqlite.org > Subject: Re: [sqlite] How to check if a record exists > > On 11/4/2014 4:47 PM, Drago, William @ CSG - NARDAEAST wrote: > >

Re: [sqlite] How to check if a record exists

2014-11-05 Thread Drago, William @ CSG - NARDAEAST
m.com > -Original Message- > From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users- > boun...@sqlite.org] On Behalf Of Darren Duncan > Sent: Tuesday, November 04, 2014 4:59 PM > To: General Discussion of SQLite Database > Subject: Re: [sqlite] How to check if a record exi

Re: [sqlite] How to check if a record exists

2014-11-04 Thread James K. Lowden
On Tue, 4 Nov 2014 21:47:20 + "Drago, William @ CSG - NARDAEAST" wrote: > I've been pulling my hair out trying to figure how to use EXISTS. I have several examples at http://www.schemamania.org/sql/#missing.table. > Is there a better/recommended way in SQLite to check if a record > exists

Re: [sqlite] How to check if a record exists

2014-11-04 Thread Igor Tandetnik
On 11/4/2014 4:47 PM, Drago, William @ CSG - NARDAEAST wrote: "SELECT count(1) DatasetID FROM UUT_Info where DatasetID = " + id + ";"; You could do select exists (select 1 from UUT_Info where DatasetID = :id); This returns 0 or 1 (record absent/present). May work fas

Re: [sqlite] How to check if a record exists

2014-11-04 Thread Darren Duncan
If all you want to know is whether a record matching a particular field value exists, then what you did is appropriate. The EXISTS construct is generally for filtering one table with another. That being said, you should be using bind parameters rather than stitching id into the SQL string itse

[sqlite] How to check if a record exists

2014-11-04 Thread Drago, William @ CSG - NARDAEAST
All, I've been pulling my hair out trying to figure how to use EXISTS. I've had no luck with it (syntax errors) and I've resorted to this. Is there a better/recommended way in SQLite to check if a record exists? static bool IDisDuplicate(string dbFileName, int id) { int cou