Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Best way to proceed.
Message
From
05/04/2007 09:20:28
 
 
To
All
General information
Forum:
ASP.NET
Category:
ADO.NET
Title:
Best way to proceed.
Miscellaneous
Thread ID:
01212417
Message ID:
01212417
Views:
52
I tried John Baird code and with minor modifications I was able to read the comma delimited text file and put it into a Datatable.

Here is how:
string colString;
string[] strItems = null;
DataRow dr = null;
TextReader tr = null;
try
 {
  DataTable dtMyTable = new DataTable();
  dtMyTable.Columns.Add("CtrlPn", typeof(String));
  dtMyTable.Columns.Add("nAmount", typeof(Double));
  dtMyTable.Columns.Add("CheckNum", typeof(String));
  dtMyTable.Columns.Add("CheckType", typeof(String));

  string filePath = @"C:\Program Files\UPCI\ExportWachovia\CPRun99_2.run";
  tr = File.OpenText(filePath);
  colString = tr.ReadLine();
  colString = colString.Trim();
  while ( colString != null )
   {
    if (colString.Length > 0)
     {
       strItems = colString.Split(",".ToCharArray());
       dr = dtMyTable.NewRow();
       dr["CtrlPn"] = strItems[0];
       dr["nAmount"] = strItems[1];
       dr["CheckNum"] = strItems[2];
       dr["CheckType"] = strItems[3];
       dtMyTable.Rows.Add(dr);
     } //if
     colString = tr.ReadLine();

   }   //while ( colString != null )
}   //try
catch (Exception ex)
 {
   MessageBox.Show(ex.Message);
 }
I would like to get opinions about the best way to proceed with my task.
Here is the situation ( foxpro thinking: scan, use, seek, replace, index ) :

Now that I have the comma delimited text file on a Datatable (dtMyTable ) I need to search for each of the records in the dtMyTable against a free foxpro table called Policy. If I found a match then retrieve information from this Policy table ( control number ) and then insert a record in a foxpro table called Transactions(insert into Trasnactions (controlnumber, .....).
Also before I insert the records into the transaction I will have to prepare/massage the data in the dtMyTable Datatable for insertion into the foxpro Transaction table.


Now here is my troubles since I'm new to ADO.NET.
What is the best way to interface with the free foxpro tables.
Do I load all the tables(policy, transaction) to a Dataset and then I seek on this Policy table, update some policy fields and insert into Transaction table. Once I am finished I sent the changes to the free table.
The Transaction foxpro free table contains 2.5 million records and Policy table has close to a million records.

Or


I can send select statements just to bring the records that match from the Policy table( like a seek )? Then once I get the match prepare the data and insert the record into the transaction table.
I guess this is the most logical way( looks like I have found the best way).



Anyfeed back is appreciated.
Sergio
Next
Reply
Map
View

Click here to load this message in the networking platform