Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

updating database source (DataGridView)

Status
Not open for further replies.

moMoney2009

Programmer
Nov 7, 2007
7
US
I'm just trying to update the actual database to reflect the changes that occur in my software. I am using the automated DataSet builder and adapter classes that VS 05 will generate for ease of use.... but I must be missing something rudimentary. can anyone shed some light on what I'm missing?

Code:
private void deleteBtn_Click(object sender, EventArgs e)
        {
            if ((row != NOT_SELECTED) && (col != NOT_SELECTED))
            {
                string[] param = new string[7];
                for (int column = 0; col < param.Length; col++)
                    param[column] = (string)customerGrid[column, row].Value;
                [COLOR=green]/*string fName = (string)customerGrid[0,row].Value;
                string lName = (string)customerGrid[1, row].Value;
                string addr = (string)customerGrid[2, row].Value;
                string zip = (string)customerGrid[3, row].Value;
                string city = (string)customerGrid[4, row].Value;
                string state = (string)customerGrid[5, row].Value;
                string pNum = (string)customerGrid[6, row].Value;
                MessageBox.Show(fName + " " + lName + " " + addr + " " + zip + " " + city + " " + state + " " + pNum);
                this.customersTableAdapter.MyDeleteQuery(fName, lName, addr, zip, city, state, pNum);*/[/color]
                this.customersTableAdapter.MyDeleteQuery(param[0], param[1], param[2], param[3], param[4], param[5], param[6]);
                this.customersTableAdapter.Fill(this.automatic_IceDataSet.Customers);
                
                [COLOR=green]//WTF???????????????
                //tried both versions to update actual database[/color]
                [COLOR=blue]this.customersTableAdapter.Update(automatic_IceDataSet.Customers);
                this.customersBindingSource.DataSource = (DataSet)this.automatic_IceDataSet;[/color]
            }
        }
 
Are you trying to update your form after deleting the entry from the table? Or is the deletion of the entry not processing correctly?
 
no, i'm trying to update the database that the form displays
 
Did you look at the asp.net link? I recently worked on an API using that structure (Using DAL and BLLs) and it is better to used than just making adapters in your program itself
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top