Click here to Skip to main content
15,887,135 members
Home / Discussions / C#
   

C#

 
Questionquestion Pin
bitayekta1-Sep-10 0:51
bitayekta1-Sep-10 0:51 
AnswerRe: question Pin
Pete O'Hanlon1-Sep-10 1:05
mvePete O'Hanlon1-Sep-10 1:05 
AnswerRe: question Pin
Smithers-Jones1-Sep-10 5:12
Smithers-Jones1-Sep-10 5:12 
GeneralRe: question Pin
Pete O'Hanlon1-Sep-10 7:45
mvePete O'Hanlon1-Sep-10 7:45 
GeneralRe: question Pin
AspDotNetDev1-Sep-10 9:16
protectorAspDotNetDev1-Sep-10 9:16 
AnswerRe: question Pin
Eddy Vluggen1-Sep-10 8:38
professionalEddy Vluggen1-Sep-10 8:38 
AnswerRe: question Pin
Dave Kreskowiak1-Sep-10 8:58
mveDave Kreskowiak1-Sep-10 8:58 
QuestionTrying to update sql table from datagrid Pin
mpanger1-Sep-10 0:31
mpanger1-Sep-10 0:31 
(i posted this incorrectly to quick answers. I am reposting this here)

I am working on my first C# SQL project. A simple checkbook register.

I referred to the CodeProject article:

Using the DataGrid Control Using the DataGrid Control[^]

I added a datagridview control to my form and set the data source as my checkbook register in SQL Express.

I am able to see all the checkbook entries when I run the form.

My first attempt at updating the sql table is generating a compile error.

The error is:
cannot convert from 'System.Data.DataSet' to 'FirstCheckBookInSQL.CheckBookManagementDataSet.CheckbookUSBPersonalDataTable'

I've been researching this for 3 days, but I'm just not making sense of what I am seeing.

Can someone help please!
Thank you.
Mark


My code in Form1.cs:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace FirstCheckBookInSQL
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();

        }

        
        private void Form1_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'checkBookManagementDataSet.CheckbookUSBPersonal' table. You can move, or remove it, as needed.
            this.checkbookUSBPersonalTableAdapter.Fill(this.checkBookManagementDataSet.CheckbookUSBPersonal);
        }

        private void TBDbutton_Click(object sender, EventArgs e)
        {

            DataSet myChangedDataSet = this.checkBookManagementDataSet.GetChanges();
            if (myChangedDataSet != null)
            {
                // get how many rows changed

// this is the line I am having trouble with:
                int modifiedRows = this.checkbookUSBPersonalTableAdapter.Update(myChangedDataSet);

                //MessageBox.Show("Database has been updated successfully: " +
                //modifiedRows + " Modified row(s) ", "Success");
                this.checkBookManagementDataSet.AcceptChanges();
                myChangedDataSet.AcceptChanges();

            }

            MessageBox.Show("no data changed");
        }
    }
}
</pre>

AnswerRe: Trying to update sql table from datagrid Pin
OriginalGriff1-Sep-10 6:16
mveOriginalGriff1-Sep-10 6:16 
GeneralRe: Trying to update sql table from datagrid Pin
mpanger1-Sep-10 7:20
mpanger1-Sep-10 7:20 
QuestionCasting a session object to a generic object Pin
Swiftain31-Aug-10 23:23
Swiftain31-Aug-10 23:23 
AnswerRepeat Pin
Not Active1-Sep-10 1:44
mentorNot Active1-Sep-10 1:44 
GeneralRe: Repeat Pin
Swiftain1-Sep-10 2:35
Swiftain1-Sep-10 2:35 
GeneralRe: Repeat Pin
Pete O'Hanlon1-Sep-10 3:09
mvePete O'Hanlon1-Sep-10 3:09 
GeneralRe: Repeat Pin
Swiftain1-Sep-10 2:36
Swiftain1-Sep-10 2:36 
GeneralRe: Repeat Pin
Not Active1-Sep-10 2:49
mentorNot Active1-Sep-10 2:49 
AnswerMessage Removed Pin
1-Sep-10 2:38
kevinnicol1-Sep-10 2:38 
GeneralRe: Casting a session object to a generic object Pin
Not Active1-Sep-10 2:52
mentorNot Active1-Sep-10 2:52 
GeneralRe: Casting a session object to a generic object Pin
Swiftain1-Sep-10 2:59
Swiftain1-Sep-10 2:59 
QuestionChange sql server product key through programming Pin
dalbhide bipin31-Aug-10 23:12
dalbhide bipin31-Aug-10 23:12 
AnswerRe: Change sql server product key through programming Pin
Goutam Patra1-Sep-10 1:41
professionalGoutam Patra1-Sep-10 1:41 
GeneralRe: Change sql server product key through programming Pin
dalbhide bipin1-Sep-10 2:54
dalbhide bipin1-Sep-10 2:54 
GeneralRe: Change sql server product key through programming Pin
phil.o1-Sep-10 3:59
professionalphil.o1-Sep-10 3:59 
GeneralRe: Change sql server product key through programming Pin
dalbhide bipin1-Sep-10 20:12
dalbhide bipin1-Sep-10 20:12 
Questionproblem in sending file with bluetooth Pin
behzadcp31-Aug-10 20:55
professionalbehzadcp31-Aug-10 20:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.