Forum > Packages and Libraries
Dbf Append , Error ?
(1/1)
Fabius:
Good morning all :)
I have an error message during execution ( compile OK )
dataset error, not in insert or edit mode
I tried with Append and insert
i still have an error
According to you or am I wrong?
Thank for Help ;D
My Code
lignesDeSaisie = Tdbf
On button command
Juste this
Try
lignesDeSaisie.Append;
/////lignesDeSaisie.Insert;
lignesDeSaisie.FieldByName('compte').AsString := Form1.Xcomptes.FieldByName('compte').AsString;
lignesDeSaisie.FieldByName('label').AsString := Form1.Xcomptes.FieldByName('label').AsString;
lignesDeSaisie.Post;
finally
end;
winni:
Hi
You did not set the DB in the edit mode.
After insert or append you have to do
--- 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";}};} ---lignesDeSaisie.Edit;
And please: use code formatting for your code!
Winni
Fabius:
Ok , Thank ;D , I test
Fabius:
I have tested
lignesDeSaisie.Append;
///lignesDeSaisie.Edit;
lignesDeSaisie.FieldByName('compte').AsString := Form1.Xcomptes.FieldByName('compte').AsString;
lignesDeSaisie.FieldByName('label').AsString := Form1.Xcomptes.FieldByName('label').AsString;
lignesDeSaisie.FieldByName('credit').AsFloat := 0;
lignesDeSaisie.FieldByName('debit').AsFloat := 0;
///lignesDeSaisie.Post;
If I del the line post , it's OK
???
wp:
The code which you show is correct. When it is not working then there must be something in your code which must put the dataset back into browse mode before you call dataset.Post. Convince yourself by means of the attached demo which simply does the same as in your code.
Make a backup of your project and remove all unnecessary parts. Usually you can find the issue this way by yourself. If not, pack the .pas, lfm, lpr, lpi and dbf files into a common zip which you can upload here.
Navigation
[0] Message Index