Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
-
sandy771
- Posts: 194
- Joined: Tue 22 May 2007 13:57
Post
by sandy771 » Wed 01 Aug 2007 14:26
Is there any documentation for TDALoader (other than the demos that come with the code)
I don't want to do anything special just load a large CSV file into a table and the demos dont make much/any sense to me
Preferrably in C++

-
Antaeus
- Posts: 2098
- Joined: Tue 14 Feb 2006 10:14
Post
by Antaeus » Wed 01 Aug 2007 15:20
You can find the description of TMSLoader/TDALoader in the SDAC help.
Note, that TMSLoader does not provide functionality for loading data from CSV files. You can solve this problem in the following ways:
- enhance the Loader demo of SDAC so that it can parse the CSV file;
- load your file using a DataSet component that can work with CSV files, and transfer records from this DataSet to the server using LoadFromDataSet method of TMSLoader.
We are investigating a possibility to add this feature in one of the next SDAC versions.
-
sandy771
- Posts: 194
- Joined: Tue 22 May 2007 13:57
Post
by sandy771 » Tue 14 Aug 2007 12:52
Am I doing something wrong
I dynamically create columns for MSLoader as
MSLoader1->Columns->Clear();
MSLoader1->Columns->Add();
MSLoader1->Columns->Items[0]->Name = "RECNO";
MSLoader1->Columns->Items[0]->FieldType = ftInteger;
MSLoader1->Columns->Add();
MSLoader1->Columns->Items[1]->Name = "KEYID";
MSLoader1->Columns->Items[1]->FieldType = ftInteger;
etc.
I then create my CSV and once done so issue a load command
MSLoader1->Load();
I then populate the table as such
void __fastcall TForm1::MSLoader1PutData(TMSLoader *Sender)
{
int i=0;
while(fgets(s, 4096, fp)!=NULL)
{
// do something here to get values from CSV
Sender->PutColumnData(0, i, ID); // recno
Sender->PutColumnData(1, i, KeyID); // keyid
i++;
}
}
When I examine the table on completion - no values have been loaded - any ideas/
-
Antaeus
- Posts: 2098
- Joined: Tue 14 Feb 2006 10:14
Post
by Antaeus » Wed 15 Aug 2007 08:06
Are there any errors raised when you call MSLoader1->Load?
Probably you should change this line:
with the following one:
-
sandy771
- Posts: 194
- Joined: Tue 22 May 2007 13:57
Post
by sandy771 » Wed 15 Aug 2007 08:13
Hi Antaeus
There are no errors when I call MSLoader->Load()
and I am sorry - my code did have i=1; (typo)
-
Antaeus
- Posts: 2098
- Joined: Tue 14 Feb 2006 10:14
Post
by Antaeus » Wed 15 Aug 2007 08:30
Please check whether the MSLoader1PutData event is raised when you call MSLoader1->Load (just add a break point inside this event).
Also verify whether queries to insert records are sent to the server. You can use the SQL Server Profiler for that.
Do you work with transactions?
-
sandy771
- Posts: 194
- Joined: Tue 22 May 2007 13:57
Post
by sandy771 » Wed 15 Aug 2007 08:49
The Putdata event is raised and my code loops through every entry in the CSV file calling PutColumnData.
I am a bit of a database newbie and AFAIAA I do not use transactions.
-
Antaeus
- Posts: 2098
- Joined: Tue 14 Feb 2006 10:14
Post
by Antaeus » Wed 15 Aug 2007 09:11
Please send me a complete small sample at evgeniyd*crlab*com to demonstrate the problem. Also include an SQL script to create the table used in your sample.
What SDAC version do you use?