IN DAL
public int DataDelete(string sql)
{
SqlCommand _objcomm = null;
DatabaseConnection _objconn = new DatabaseConnection();
_objcomm = _objconn.GetCommand();
_objcomm.Connection.Open();
_objcomm.CommandText = sql;
int result = _objcomm.ExecuteNonQuery();
return result;
_objcomm.Connection.Close();
}
IN C# part
protected void btnSubmitdb_Click(object sender, EventArgs e)
{
DatabaseConnection objconn = new DatabaseConnection();
string sql = "Insert into Table_Details values('"+txtNamedb.Text+"','"+ txtAgedb.Text+"','"+ txtEmaildb.Text+"')";
objconn.DataInsert(sql);
}
protected void btnDeletedb_Click(object sender, EventArgs e)
{
DatabaseConnection objconn = new DatabaseConnection();
string sql = "DELETE FROM Table_Details WHERE Id=@Id";
objconn.DataDelete(sql);
}
the insert and select action are being performed.I have use the similar function for insert and delete..Does it creates aProblem??? The datas are displayed in grid view then how to delete the entire row from gridview and from database????