0

Hello everyone!

First of all this is about DataSets. I made a table with some examples in MS Access and now I need to add new rows into this table from C# console application. I added DataSet (MSAccessBase) and used TableAdapter for adding MS Access's table into project Solution.

I tryed many things to add new row into MS Access table but always unsuccessful. I have no idea why this code doesn't work:

class Program
    {
        static void Main(string[] args)
        {
            //MSAccessBase is the name of added DataSet (for table Person from MS Access database)
            MSAccessBase thisBase = new MSAccessBase();

            PersonTableAdapter personTA = new PersonTableAdapter();
            personTA.Fill(thisBase.Person); //fill the DataTable

            DataRow rowPerson = thisBase.Person.NewRow();
            rowPerson["ID"] = "2";
            rowPerson["Name"] = "Peter";
            rowPerson["Surname"] = "Colton";
            rowPerson["Email"] = "peter.colton@gmail.com";

            thisBase.Person.Rows.Add(rowPerson);
        }
    }

Any help is the most welcome!

Edited by danuzje: n/a

2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by thines01
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.