Click here to Skip to main content
16,021,041 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I need to copy records from Paradox-7 tables to SQL Server 2008.

I have created a stored procedure in SQL Server 2008 with a table-type input parameter.

Using Delphi 2010, how can I send a Paradox DB table's records to this stored procedure?

The tables already exist in SQL Server.

I tried this, but it gives an error regarding the paramater type:
Delphi
VAImpTable.Open;   // this is a BDE TTable component
// spBatchInsert is a dbExpress TSQLStoredProc component
spBatchInsert.ParamByName('@input_table').AsDataSet := VAImpTable;
try
  spBatchInsert.ExecProc;
except on e: Exception do
  ShowMessage(e.Message);
end;
VAImpTable.Close;
Posted
Updated 12-Jan-12 0:17am
v2
Comments
MahendranGK 12-Jun-14 5:58am    
Can anyone help me on this. This solution doesnt work. THanks in advance

1 solution

Hi,

I know this is probably a bit too late, but since there haven't been any responses, I might as well give this a shot. I may be wrong regarding this, but shouldn't that code looks something like:

Delphi
VAImpTable.Open;
VAImpTable.First;
VAImpTable.FetchAll; // Make sure we have ALL the data for the migrate
VAImpTable.First; // Just to make sure that we are back at the first record
spBatchInsert.ParamByName('@input_table').DataType := ftDataSet;
spBatchInsert.ParamByName('@input_table').Direction := pdInput;
spBatchInsert.ParamByName('@input_table').Value := VAImpTable;
try
  spBatchInsert.ExecProc;
except on e: Exception do
  ShowMessage(e.Message);
end;
VAImpTable.Close;

I know the "AsDataSet" is short-hand, but personally I prefer setting certain properties, especially things like data source parameter inputs, explicitly.

Having said that though, I had issues many moons ago converting the data source of an application from one provider to another. I just ended up writing a generic class that would physically move the data from the one to the other.

At that stage, it proved to be much more reliable, because I could then write descendant classes which would then be specific to certain types of (provider) database types as some (field) definitions didn't port properly between the two.

Hope that helps,
Glen
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900