Save records from DBGrid to Txt File
Hi
I have an application that is connected with SQLServer 2000 and BCB6.
I have the records in DBGrid to saw them in my application.. My question is how i can save this records to txt file?? Any code ideas??
My fields are: Name and Size
So i want to save them in txt file.. Is possible that???
i did something like this
ADOTable1->SaveToFile("c:\\86.txt"); but is totally wrong because i want to save only the above 2 fields and all i get in this file is strange letters
Please help
Re: Save records from DBGrid to Txt File
Try "manually" looping on the records and writing the relevant values to the file the way you want. There probably isn't a one-line solution to this...
Re: Save records from DBGrid to Txt File
what you mean? Any code ideas???
Re: Save records from DBGrid to Txt File
Following is what I meant expressed in semi-pseudo-code:
for (int i = 0; i < ADOTable1->RecordCount; i++)
{
Write to file the values you want, e.g.:
ADOTable1->FieldByName("Abc")->AsString + ", " + ADOTable1->FieldByName("Xyz")->AsString + ...
}
Re: Save records from DBGrid to Txt File
Ok seem good but how i am gonna write it in file. I mean you dont use file.