LINQ to DataSet - perform an insert or update - in C# syntax

Trying to learn LINQ:

DataSet ds = DataHelper.ReturnDataSet("select * from llpp_users");

            DataTable dt = ds.Tables[0];

            var query =
                    from o in dt.AsEnumerable()
                    where o.Field<string>("email") == email
                    && o.Field<string>("password") == password
                    select o;

            int count = query.Count();

            if (count == 1)
            {
                Response.Write(query.ElementAt(0).Field<string>("username") + " is signed in.");
            }


This seems to work........but how do I do an INSERT or an UPDATE using LINQ syntax  (notice that I am using LINQ to DataSet)
LVL 5
Tom KnowltonWeb developerAsked:
Who is Participating?

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

x
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.

lazyberezovskyCommented:
Well, I think you should not do INSERT or UPDATE using language-integrated QUERY (LINQ). Purpose of LINQ to DataSet is to simplify querying data from DataSets, because original DataSets objects provided very poor functionality with Select method.
0

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
Tom KnowltonWeb developerAuthor Commented:
Oh....

Uh....  okay.
0
lazyberezovskyCommented:
Hi, knowlton

Sorry, I was not complete about this. You can change data in your DataTable via calling SetField method.
E.g:

foreach (var row in query)
    row.SetField<string>("email", "test@mail.com");

After that you can insert/update data from your DataSet to database via DataAdapter.
0
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
ASP.NET

From novice to tech pro — start learning today.