Ted is, and always has been, a King amongst VFP men and women. 😊
In the wondrous world of computer programming, not only do words have meaning but so do individual letters. And let's not get started on case sensitivity... I've been bitten by something like this before as I'm sure most of us have. The efficient brain takes shortcuts whenever possible so if you expected to see a particular thing in a particular context, it shows that to you.
--
rk
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Paul H. Tarver Sent: Thursday, November 16, 2017 9:40 AM To: profoxtech@leafe.com Subject: RE: SQLite Problem - DSN-less Connection Doesn't Create A File
Ok, I formally nominate Ted Roche to be VFP King and SQLite Guru! All those in favor? :)
I changed "DBNAME" in the connection string to "Database" and it worked perfectly the first time.
I knew it was going to be something stupid, but I didn't realize it was THAT stupid. I can only claim programming blindness. I looked at the string in Whil's book a thousand times and compared it to my code and never saw it. I've been doing a lot of work lately connecting Foxpro to MySQL for another project and DBNAME came over from that connection string. Of all the changes I made to the connection string, I never changed, deleted or replaced the Driver & DBAME key words. I changed everything else from the other key pairs to the location and name of the database, but I am embarrassed to say I never looked to the left of the equal sign to see the bad key word. Around here they say, "If it had been a snake, it would have bit me."
One weird thing remains: As I mentioned in the original post, prior to rebooting my computer, I NEVER got an error message and I always got a valid handle back when I tried to make a connection and I was able to create tables, insert data and select results. I can only assume it was because SQLite allows you to create an in-memory database with a blank name, maybe that was how I got a valid handle, but why did it fail to repeat that behavior after the reboot? Was it because I established a valid DSN earlier in testing and somehow it was piggy-backing on that connection? As I say, weird.
Thank you Ed for providing the ProFox list. Without this place I don't know how long it would have taken me to figure this issue out if ever.
Paul H. Tarver Tarver Program Consultants, Inc. Tel: 601-483-4404 Email: paul@tpcqpc.com
-----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Ted Roche Sent: Thursday, November 16, 2017 7:58 AM To: profoxtech@leafe.com Subject: Re: SQLite Problem - DSN-less Connection Doesn't Create A File
On Thu, Nov 16, 2017 at 6:25 AM, Ted Roche tedroche@gmail.com wrote:
On Wed, Nov 15, 2017 at 7:14 PM, Paul H. Tarver paul@tpcqpc.com wrote:
Ok, I give up. I've been using Whil Hentzen's book "Using SQLite to Bypass The 2GB .DBF Filesize Limit" for a project I'm trying to develop and I have some weird behavior going on.
Having worked with Whil on a half-dozen books now, I have to say, weird behavior is par for the course. ;)
Here's what I did. I called up a DSN I had previously created and like you, copied the ConnectString when it opened. The only big difference I notice is that my string is using "Database" rather than DBNAME.
? SQLStringConnect("Driver={SQLite3 ODBC Driver};Database=C:\Users\tedro\Documents\newexample.sqlite;StepAPI=0;SyncPr agma=;NoTXN=0;Timeout=;ShortNames=0;") ? SQLExec(4, "Create table Example2 (key int, description text)") ? SQLExec(4, "insert into Example2 (key, description) values (1,'The first')") ? SQLExec(4, "insert into Example2 (key, description) values (2,'The second')")
the "newexample.sqlite" database did not exist before I started. It's on disk now, at 8 kb.
-- Ted Roche Ted Roche & Associates, LLC http://www.tedroche.com