Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old April 16th, 2005, 02:47 AM
Registered User
Join Date: Apr 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default adding to a dataset

i have a single form with two textbox entries connected to a Access db.

it fills and the two entries are seen at load....but i cant seem to add a new entry, i clear the values first and am completly stuck. ive tried....
    private void Form2_Load(object sender, System.EventArgs e)
oleDbDataAdapter1.Fill (dataSet11);
        private void button1_Click(object sender, System.EventArgs e)
        dataSet11.Table1.Rows .Add textBox1.text;// no way

completly knackered any ideas?

Old April 16th, 2005, 08:25 AM
Friend of Wrox
Join Date: Jul 2004
Posts: 623
Thanks: 0
Thanked 1 Time in 1 Post

object[] entries={textBox1.Text,textBox2.text};//according to the columns
if that array doesnt fit the column of dataset a exception would be thrown.now just DataSet is updated not DB.

software student.
Old April 16th, 2005, 10:44 PM
planoie's Avatar
Friend of Wrox
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts


Simply adding rows to a dataset table isn't enough. A DataSet is a disconnected data construct. You need to make a call back to the database to insert/update your data. You can do this several different ways. Usually there is a preferred way based on what kind of application you are creating.


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding row to dataset in C# MAKO C# 2 March 11th, 2010 08:10 AM
Adding a new record to a dataset Louisa VB.NET 2002/2003 Basics 1 January 14th, 2004 05:33 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.