McPain 0 Posted June 28, 2022 Hi all, I am using Dbgrid with FDquery and have a connection to an MDB database. I can access and save data, all good. Now I am trying to export the data via fdquery.SaveToFile('Filename.xml', sfAuto ). The procedure is creating an XML file. Also fine. How can I read in (import) this data again? When I try this: fdquery.LoadFromFile('Filename.xml', sfAuto ); fdquery.Edit; fdquery.Append; fdquery.UpdateRecord; I get all data into the DBgrid, but the data is not getting saved into the MDB. What do I miss? Thx! Alexander Share this post Link to post
Stano 143 Posted June 28, 2022 For example, a separate query of type "INSERT INTO" Share this post Link to post
Dmitry Arefiev 101 Posted June 28, 2022 https://docwiki.embarcadero.com/Libraries/Alexandria/en/FireDAC.Stan.Option.TFDBottomResourceOptions.PersistentFileName Share this post Link to post
McPain 0 Posted June 29, 2022 why a "insert into" when the DBgrid is permanently connected to the database? The link I got but do not really understand how to add this to my code or processes. Share this post Link to post
Stano 143 Posted June 29, 2022 (edited) DBGrid nepoužívam. Neverím, že ak pustíte DataSet do DBGrid, automaticky to uloží do DB. To by bola obrovská chyba. Môj pohľad na problém: Načítavate údaje zo súboru Vložíte ich do DBGrid Pracujete s DBGrid Ukončili ste DBGrid Nikde som si nevšimol: Načítavam dáta zo súboru - načítané dáta uložím do DB! Musíte to urobiť sami DBGrid to sám od seba neurobí I looked at the link. I understand that it only works with the file. Not with DB. But I don't know English and my knowledge is poor. Edited June 29, 2022 by Stano Share this post Link to post
Lajos Juhász 293 Posted June 29, 2022 1 hour ago, McPain said: why a "insert into" when the DBgrid is permanently connected to the database? After you save the data to the file. Someone can edit the file or the original data in the database, thus the program should figure out how to merge back the data. 1 Share this post Link to post
McPain 0 Posted July 18, 2022 yes the data is inside the file up2date, but when I refresh the old data from the DB come in. My goal: - enter data into Dbgrid - save into XML - load data from XML to present data inside DBgrid Share this post Link to post
weirdo12 19 Posted July 20, 2022 On 7/18/2022 at 6:47 AM, McPain said: yes the data is inside the file up2date, but when I refresh the old data from the DB come in. Refresh meaning you call TFDQuery.Refresh? Share this post Link to post
McPain 0 Posted July 21, 2022 yes I tried this as well. After refresh the DGbrid show the old data, so no update is happening to the database. Share this post Link to post