Help with c# project

this is what i have to do:

Write a C# Windows Forms application that is capable of reading in a CSV file
and writing the records to an Access table.


The Comma Separated Value file will be a predefined format (see below).
You will need to create an MS Access database containing a table called Customers
with the following record schema:


CustNum           integer

LastName         Text (25)

FirstName         Text (20)

Address            Text (30)

City                  Text (20)

Postal               Text (10)


Test your program using the following input data:



"0001","Smith","Billy-Bob","123 Small St.","London","N7R 2X6"

"0002","Jones","Mary-Lou","456 Big St.","London","N7H 5B7"

"0003","Peterson","Mike","789 Medium Ave.","Waterloo","N8H 1C6"


Your window must contain only 2 buttons (Load CSV and Cancel) and a
text box (defining the CSV input file name). Your input file name should
default to the name Customers.txt (included with the project zip file) and your
output database should be called Customers.mdb.




You must use 100% C# code to connect to the Access database and insert the records.

Use StreamReader to input the CSV records and parse out each field in each row using
suitable string processing techniques.

this is what i have:(the one i have is backwareds to the description up there i need to know how i can go the other way like in the description)

private void output_Click(object sender, System.EventArgs e)
                  OleDbDataAdapter da;
                  DataSet ds = null;
                  string connS = @"Provider=Microsoft.JET.OLEDB.4.0;data source=ppp2.mdb";
                  ds = new DataSet();
                  OleDbConnection connection = new OleDbConnection(connS);
                  string sqlString = "SELECT * FROM PARTS";
                  da =new OleDbDataAdapter(sqlString,connection);


                  catch(Exception ex)
                        MessageBox.Show("Problem with DB access-\n\n" + ex.ToString());

                  int[] F1 = new int[ds.Tables["Parts"].Rows.Count];
                  string[] F2 = new string[ds.Tables["Parts"].Rows.Count];
                  string[] F3 = new string[ds.Tables["Parts"].Rows.Count];
                  int[] F4 = new int[ds.Tables["Parts"].Rows.Count];

                  for(int i=0;i<ds.Tables["Parts"].Rows.Count;i++)
                        F2[i]=(string) ds.Tables["Parts"].Rows[i]["Description"];
                        F3[i]= (string) ds.Tables["Parts"].Rows[i]["Location"];
                  FileStream fs = new FileStream("Parts.txt",FileMode.Create);
                  StreamWriter sr = new StreamWriter(fs);
                  for(int i=0;i<ds.Tables["Parts"].Rows.Count;i++)
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Homework ??
roman100Author Commented:
ya its part of a big assignment
Im not going to do your homework for you! hahaah
But this the framework I would use.

//Create some constants that use use an index to keep track of the column name.

private const int CustNum = 0;
private const int LastName = 1;

//Then open the FileStream
System.IO.FileStream fs = new System.IO.FileStream("csv.text");
System.IO.TextReader tr= new System.IO.TextReader(fs);

//load the current line from the file into an array
string line;
While ((line = tr.ReadLine()) != null)
     string[] newRow = line.Split(",");
     //and then add the array values to your dataTable based on the
     //constants (indexes) declared above..
     DataRow dr = myTable.NewRow();
    dr[CustNum] = newRow[custNum];
    dr[LastName] = newRow[LastName];
     //add the row to the datatable.

  Hope this helps.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.