URGENT : PB Delete Row in Northwind.mdb
From: ptreves (ptreves_at_sympatico.ca)
Date: 03/25/04
- Next message: Sai: "MDAC version issue"
- Previous message: Andreas: "Re: changing dataformat from german to us-englisch"
- Next in thread: Val Mazur: "Re: URGENT : PB Delete Row in Northwind.mdb"
- Reply: Val Mazur: "Re: URGENT : PB Delete Row in Northwind.mdb"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 25 Mar 2004 09:21:06 -0800
Hello,
I am writing as ASP.NET application using a DataGrid Web COntrol.
I included a Delete, Edit/Update/Cancel, Select button columns to my DataGrid.
When I click the Delete button, I trap the event.
My code however does not delete the selected row.
Here is my sample Delete function :
-----
private void deleteRow(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
try
{
ErrorMessage.Text = "";
OleDbCommand delCommand = new OleDbCommand();
delCommand.Connection = oleDbConnection1;
delCommand.CommandText = "DELETE FROM Customers " +
"WHERE CutomerID = '" + e.Item.Cells[9].Text + "'";
delCommand.CommandType = CommandType.Text;
oleDbConnection1.Open();
delCommand.ExecuteNonQuery();
oleDbDataAdapter1.Fill(dataSet11);
Cache["CustomerData"] = dataSet11;
bindGrid();
oleDbConnection1.Close();
}
catch (Exception ex)
{
ErrorMessage.Text = ex.Message;
}
}
-----
Any feedback is appreciated,
Regards,
Paolo
- Next message: Sai: "MDAC version issue"
- Previous message: Andreas: "Re: changing dataformat from german to us-englisch"
- Next in thread: Val Mazur: "Re: URGENT : PB Delete Row in Northwind.mdb"
- Reply: Val Mazur: "Re: URGENT : PB Delete Row in Northwind.mdb"
- Messages sorted by: [ date ] [ thread ]