Jump to content
McPain

FDquery LoadfromFile

Recommended Posts

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

For example, a separate query of type "INSERT INTO"

Share this post


Link to post

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
Posted (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 by Stano

Share this post


Link to post
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.

  • Like 1

Share this post


Link to post

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
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

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×