D
Duane Leem, BSIT
Hi guys, I'm receiving this error:
'System.Web.UI.WebControls.BaseDataList.DataKeys' Denotes a 'property' where a 'method' was expected
It appears the error is at the DataKeys part... I highlighted it in red. Anyone know why this is causing an error?
------------------------------------------------------------------------------------------------------------------------
private void dgToDoList_DeleteCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
int ID = dgToDoList.DataKeys(e.Item.ItemIndex);
OleDbConnection cnINEXP = new OleDbConnection(sConnectionString);
OleDbCommand oCommand = new OleDbCommand();
string sQuery = "DELETE FROM [To Do List] WHERE ID=" + "ID";
oCommand = new OleDbCommand(sQuery, cnINEXP);
cnINEXP.Open();
oCommand.ExecuteNonQuery();
cnINEXP.Close();
}
'System.Web.UI.WebControls.BaseDataList.DataKeys' Denotes a 'property' where a 'method' was expected
It appears the error is at the DataKeys part... I highlighted it in red. Anyone know why this is causing an error?
------------------------------------------------------------------------------------------------------------------------
private void dgToDoList_DeleteCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
int ID = dgToDoList.DataKeys(e.Item.ItemIndex);
OleDbConnection cnINEXP = new OleDbConnection(sConnectionString);
OleDbCommand oCommand = new OleDbCommand();
string sQuery = "DELETE FROM [To Do List] WHERE ID=" + "ID";
oCommand = new OleDbCommand(sQuery, cnINEXP);
cnINEXP.Open();
oCommand.ExecuteNonQuery();
cnINEXP.Close();
}