jmcilhinney said:Moved to more appropriate forum.
Visit www.connectionstrings.com to get the appropriate connection string for FoxPro. Create a OleDbDataAdapter to retrieve the required data from FoxPro into a DataTable. If there are multiple tables then use multiple data adapters to fill multiple DataTables. If you set the AcceptChangesDuringFill property to False then all the DataRows will have a RowState of Added, which means you can then insert them into SQL Server directly. You can either use SqlClient to connect to SQL Server or use OleDb and use the same data adapters that you used to retrieve the data.
Could you be a bit more specific? What are you attempting and what is happening?srivalli said:i am unable to transfer that data into SQL server data base
jmcilhinney said:Could you be a bit more specific? What are you attempting and what is happening?
TechGnome said:Here's what you will need to do:
1) Make sure the destination tables exist in the SQL Server.
2) Open a connection to FoxPro
3) Open connection to SQL Server
4) Select the data from FP and put it into a DataSet/DataTable
5) Select from the SQL Server the corresponding table (yes, I know it'll be blank, we're getting the table schema, which is what we really want)
6) For each DataRow in the FP DT.... create a new DataRow for the SQL DT and add it
7) Once done copy the data from one DataTable to the other.... CommitChanges back to the SQL Server database
8) Repeat steps 4-7 for each table you want to copy over
9) Once done, read up on DTS and learn how it could have saved you from hours of doing it the hard way.
10) Vow that next time, you'll swear you'll use DTS.
-tg
jmcilhinney said:You said you are "unable". What does that mean? Your legs are broken and you can't get to your computer? You don't know how to insert records into a database? You've written some code but it throws an exception? That's what I meant about being more specific. I'm not going to waste my time writing a big explanation from start to finish if you've already done most of it yourself. How about you try to help us help you? Think about what you would need to help someone with a problem. Would "I am unable" be sufficient information?