برنامه نویسی

if (textBox2.Text != "")

{

string conStr;

string strSql; //ارتباط با پایگاه داده ها

conStr = "provider = microsoft.jet.OLEDB.4.0;" + "Data Source =d:\\db1.mdb";

OleDbConnection con = new OleDbConnection(conStr);//باز کزدن اتصال

con.Open(); //دستور برای بازیابی تمام فیلدهای جدول

strSql = "Delete from table1 where (shs='" + textBox2.Text + "')";//برای اعمال تغییرات یک نمونه می سازیم

//strSql = "Update Table1 Set shs='"+textBox2.Text+"' where (t='"+textBox1.Text+"')";

OleDbDataAdapter da = new OleDbDataAdapter(strSql, con);

DataSet ds = new DataSet();//اعمال دستور مورد نظر در پایگاه داده ها

da.Fill(ds, "Table1");

con.Close();

textBox1.Text = "";

textBox2.Text = "";

textBox3.Text = "";

textBox4.Text = "";

textBox5.Text = "";

textBox6.Text = "";

textBox7.Text = "";

MessageBox.Show("سند مورد نظر حذف شد");

}

else

MessageBox.Show("شماره سند وارد نشده یا سند موجود نیست");

+ نوشته شده در  چهارشنبه دوم بهمن ۱۳۸۷ساعت 6:41  توسط ابراری |