[fpc-devel] odbcconn.pas

Nathan Wild nathan.wild at gmail.com
Fri Mar 14 13:10:56 CET 2014


I'm betting the lack of calling applyupdates() is my problem then,  at
least when accessing the data programmatically.

Still doesn't explain why changes made in bound controls disappear also?
I'll investigate this further on the Lazarus end.

Thanks very much!

Nathan T. Wild
On Mar 14, 2014 4:08 AM, "Michael Van Canneyt" <michael at freepascal.org>
wrote:

>
>
> On Thu, 13 Mar 2014, Nathan Wild wrote:
>
>  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.
>>
>
> You must call applyupdates. Post only modifies the in-memory copy of the
> data, but doesn't actually execute any queries on the database.
> Only when you call ApplyUpdates(), the SQL will be executed to update the
> database.
>
> Michael.
> _______________________________________________
> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20140314/b16f5475/attachment.html>


More information about the fpc-devel mailing list