Code:
private void deletepcsetting_Click(object sender, EventArgs e)
{
DialogResult dialogResult = MessageBox.Show("Are you sure want to delete PC No " + listBox1.SelectedItem + "?", this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
if (dialogResult == DialogResult.Yes)
{
PCNo selectedPCNo = (PCNo)listBox1.SelectedItem;
if (selectedPCNo != null)
{
OleDbCommand cmd = new OleDbCommand("DELETE FROM ClientListing WHERE PCNO = " + listBox1.SelectedItem + "", GetConnection());
_pcno.Remove(selectedPCNo);
}
GetConnection().Close();
}
}
i also has tried to change delete command from " + listBox1.SelectedItem + " to "selectedPCNo" but i don't get luck..does anyone know how to achieve this? sorry for my bad english anyway..






