private void button1_Click_1(object sender, EventArgs e)
{
/* this.Controls
string constr = CommonUtils.GetDbConnectionString();
SqlConnection con = new SqlConnection(constr);
this.Cursor = Cursors.WaitCursor;
con.Open();
SqlCommand sql = con.CreateCommand();
sql.CommandText = "delete from logon where ";
SqlDataReader dar = sql.ExecuteReader();
con.Close();*/
if (this.listView1.SelectedItems.Count == 0)
{
MessageBox.Show("請選擇要洗掉的資料行", "錯誤", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else
{
string constr = CommonUtils.GetDbConnectionString();
SqlConnection conn1 = new SqlConnection(constr);
conn1.Open();
string sql = string.Format(" delete from logon where id ={0} ", Convert.ToInt32(listView1.SelectedItems[0].Text.ToString()));
SqlCommand command = new SqlCommand(sql, conn1);
int a = command.ExecuteNonQuery();
this.listView1.SelectedItems[0].Remove();
}
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/69573.html
標籤:ASP.NET
上一篇:【求助大佬】
