سلام
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;
namespace AccessTestDB
{
public partial class frmBook : Form
{
public frmBook()
{
InitializeComponent();
}
OleDbConnection con = new OleDbConnection("provider=microsoft.jet.oledb.4.0; data source=TestDBAccess.mdb");
OleDbCommand cmd = new OleDbCommand();
private void btnDelete_Click(object sender, EventArgs e)
{
cmd.Parameters.Clear();
cmd.Connection = con;
cmd.CommandText = "delete from TBLBook where ID="+txtCode.Text;
con.Open();
cmd.ExecuteNonQuery();
con.Close();
MessageBox.Show("اطلاعات با موفقیت حذف شد", "پیغام موفقیت");