none
Updating a SQL database from a windows form RRS feed

  • Question

  • I have a SQL database with two tables in it.  They have a foreign key relationship, and the first table populates a list box and depending on what choice is made in the list box there is a data grid that displays a filtered list of information.  I'm having trouble getting the data grid to save the new or modified data back to the database using the Update() method.

    Any assistance would be helpful,
    Thank you,
    Stephan
    Saturday, June 23, 2007 4:52 AM

All replies

  • Post an example of your code and we can see where the problem is...

     

    Here is a good example of how to update

     

    http://www.codeproject.com/cs/database/DataGridView2Db.asp

     

     

    Saturday, June 23, 2007 3:23 PM
  • Here's all of the code that deals with the database...it's actually pretty much all the code I have worked  on so far.

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

            private void updateButton_Click(object sender, EventArgs e)
            {
                this.fKEventsThespiansBindingSource.EndEdit();
                this.thespiansBindingSource.EndEdit();

            }
    Saturday, June 23, 2007 5:49 PM
  • The link you provided was helpful, but I don't think that it helped.  I still can't get my program to save data back to the database.  At most the data appears until the program exits.  This link I'm providing is more of what my program does.  I'll browse the site for more information though.


    http://www.codeproject.com/useritems/ComboboxGridFilter.asp
    Wednesday, June 27, 2007 1:00 AM