Forum > Databases

Updating data from a KDBGrid to SQLite

(1/2) > >>

heebiejeebies:
Hi all,

I feel like this is a really simple question that I should know the answer to, but unfortunately I am a little bit stupid and cannot find straightforward answers anywhere!   :(

I have a DBGrid (actually a KDBGrid) that loads fields from a table CurrentSession using DataSource1 and SQLQuery1.  My transaction is called UserFileTransaction.

OnChange appears to be the most appropriate event available in a KDBGrid.  Is there a simple code I can add to this event that will save the user's edits to the database?  Here is my best attempt so far, for your amusement:


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---Userfiletransaction.Active := true;  SQLQuery1.ApplyUpdates;  Userfiletransaction.Commit;  
Hope you all got a good chuckle out of that. Now anyone know what I actually need to do?

My eternal gratitude for any suggestions, and also for not throwing rotten fruit at me.  :D

heebiejeebies:
By the way, I didn't bother including it because I figured my code is probably completely wrong from the ground up, but the error I'm getting from it is "cannot start a transaction within a transaction".  I have no other transactions active.  Halp please

Chris78:
Hi.

What happens if you don't use any transaction ?

heebiejeebies:
Hi, thanks for the reply.

What happens is - absolutely nothing. No error, but no result either.

Zvoni:
Does the same happen with a "regular" DBGrid?

Navigation

[0] Message Index

[#] Next page

Go to full version