[fpc-devel] odbcconn.pas
Nathan Wild
nathan.wild at gmail.com
Thu Mar 13 14:20:36 CET 2014
Thanks so much for responding! I am extremely excited about the prospect
of getting this working.
Nothing I do in databound controls seems to commit anything to the
underlying dataset.
If I open a connection, activate a TSQLQuery with 'SELECT * FROM AnyTable',
connect it toa dbgrid, etc. I can delete rows, edit data etc. and it
appears to work normally. Changes take effect inside the controls, values
change in the dataset, etc. but as soon as I disconnect and reconnect the
dataset all my changes are reverted.
ODBCConnection1.Connected := TRUE;
SQLQuery1.SQL.Clear();
SQLQuery1.SQL.Append('SELECT * FROM AnyTable');
SQLQuery1.Active := TRUE;
SQLQuery1.Delete();
SQLQuery1.Edit();
SQLQuery1['AnyField'] := 'CHANGED';
SQLQuery1.Post();
All of these changes take place in the UI. i.e. the first row is deleted
and the field is modified in the second. As soon as I close and re-open
the table, both changes are undone.
UPDATE and DELETE queries work as expected.
Some notes:
- Calling combinations of StartTransaction / Commit / CommitRetaining don't
appear to do anything?
- Nothing I do changes the Active property of the associated
SQLTransansaction (I'm not actually sure if anything should? Just
mentioning it as this feels to me like a commit problem)
- I have nothing set in the UpdateSQL / DeleteSQL / InsertSQL properties of
the TSQLQuery. Are these required when accessing data in this manner?
Thanks again to all who take the time to read this and I hope I'm not just
missing something stupid!!
On 13 March 2014 05:25, Reinier Olislagers <reinierolislagers at gmail.com>wrote:
> On 13/03/2014 00:06, Nathan Wild wrote:
> > I have been transitioning my work over from Delphi to Lazarus. For the
> > most part it has been smooth and satisfying experience. I'm loving
> > Lazarus and FPC and being unburdened by closed source proprietary stuff
> > in general.
> Good to hear that ;)
>
> > The majority of the work I do requires connections to a Pervasive
> > database (from Btrieve v6 all the way up to the most current). I should
> > be able to do this via ODBC. I have no problem reading data, executing
> > queries, etc. but as soon I try and act on a TSQLQuery using methods
> > like .Delete(), .Append(), etc. everything appears to work fine, but as
> > soon as the dataset refreshes my changes disappear. I can write to the
> > same tables using INSERT, DELETE and UPDATE queries without issue.
> >
> > Am I missing something stupid?
> We don't know your code, so no idea... <open door> Are you .Posting the
> data?
>
> To give you an idea, the GUI/RAD tutorials
> http://wiki.lazarus.freepascal.org/SQLdb_Tutorial0
> http://wiki.lazarus.freepascal.org/SQLdb_Tutorial1
> and
> http://wiki.lazarus.freepascal.org/SQLdb_Tutorial2
> should work with odbc as well as with other dbs; just use odbcconn..
>
> Also, you could have a look at the database test suite:
> http://wiki.lazarus.freepascal.org/Databases#Running_FPC_database_tests
> fpc\packages\fcl-db\tests\dbtestframework.pas
>
> The info on
> http://wiki.lazarus.freepascal.org/ODBCConn
> you probably already know about as you can connect etc.
> Please feel free to document any hints/tips/needed additions for
> Pervasive there...
>
> You could create a minimal test program based on
> http://wiki.lazarus.freepascal.org/Database_bug_reporting#FreePascal
> and post on the forum
> http://forum.lazarus.freepascal.org/index.php/board,63.0.html
> with an attachment.
>
>
> _______________________________________________
> fpc-devel maillist - fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
>
--
*Nathan T. Wild*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20140313/3627e96f/attachment.html>
More information about the fpc-devel
mailing list