Linking Connection to Grid

Discussion of open issues, suggestions and bugs regarding usage of dbExpress drivers for SQLite in Delphi and C++Builder
Post Reply
P Scott
Posts: 12
Joined: Wed 21 Dec 2011 15:14
Location: USA

Linking Connection to Grid

Post by P Scott » Sat 08 Jun 2013 15:05

Hi,

I am having problems doing the simplest task here. I have gotten the demo for SimpleDataSet to work pretty well, but after setting up my own new project, and keeping it VERY simple, I see the column names in the grid, but NO data appears. The data shows fine in my SQLite utility, SQLite Maestro. I am using DXE2 and the Devart SQLite driver (dbexpsqlite40.dll) from Dec, 2011. What I did is basically:

1. set up Connection, SimpleDataSet, DataSource and Grid, trying to follow the settings, links, and properties in the demo.

2. I mostly used component properties from the demo, but tried many variations. :? Also tried a lot of things in the SQLConnections.Database.Params basically from the demo examples.

3. Kept the actual code I wrote really brief (3 lines). Put a button on the form with the following code:

{$I .\SetLibName.inc}
SQLConnection1.Open;
SimpleDataSet1.Open;

I copied the SetLibName.inc. used by the demo into my own project folder. Again, when I click on my button, the column names appear but no data.

Thanks for any clues!

P. Scott

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Linking Connection to Grid

Post by AlexP » Mon 10 Jun 2013 07:24

Hello,

You are using a rather old dbExpress driver for SQLite version. Please try reproducing the problem on the latest dbExpress driver for SQLite version. If the problem repeats, contact us again.

P Scott
Posts: 12
Joined: Wed 21 Dec 2011 15:14
Location: USA

Re: Linking Connection to Grid

Post by P Scott » Mon 10 Jun 2013 15:09

Thanks. Some progress!
I updated to the latest driver. Not sure I did that right, but now I can view the database and table fields in the data explorer, which is very nice and a new feature for me. But under "vendor library" I still need to have "sqlite3.dll" and I thought that had been changed so it would accept the dbxsqlite40.dll entry there. Also, after installing the driver update, I had the message that package 'dcldbxsqlite160" could not be loaded because it was contained in 2 units. I removed the conflicting unit (from Embarcadero I think), and left the unit in DBXDevartSQLite160, then no error messages.

I do now see data in the database both in the data explorer and in the grid when I run my program! The problem is now with "ApplyUpdates". When I make a change and use my "Apply Updates" button, the change fails to be saved EXCEPT for data added to a NEW row. I tried adding the "edit" and "post" lines as in the code below. I also added the count for ApplyUpdates errors, and if I try to make changes to 1 or 2 existing rows, I then get a count of 1 or 2 errors.
Maybe I need to start and commit a transaction, but I don't see any sample code on how to do that?

Apply Updates Button Code:

SimpleDataSet1.Edit;
SimpleDataSet1.Post;
i:= SimpledataSet1.ApplyUpdates(-1);
if i <> 0 then
raise Exception.Create(IntToStr(i)+' errors on ApplyUpdates occured');

P Scott
Posts: 12
Joined: Wed 21 Dec 2011 15:14
Location: USA

Re: Linking Connection to Grid

Post by P Scott » Wed 12 Jun 2013 13:41

Problem solved (?)
After installing the most recent DBX driver, I was able to apply updates to newly created tables in my database (or to newly inserted lines in the old tables). Eventually I just ended up re-creating the table with the EXACT same fields and data, and the new (identical?) table works and can apply updates. Strange, but now working. :D

Scott

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Linking Connection to Grid

Post by AlexP » Thu 13 Jun 2013 10:18

Hello,

You can use the Direct mode on a win32 platform with no need for the sqlite3.dll library. For this, in the connection settings select Devart SQLite Direct instead of Devart SQLite.

Post Reply