我是 C# 的初学者。我正在尝试创建一个网站
我有一个问题要提供删除选项。没有错误显示。但是记录没有被删除
请帮忙
protected void delete_button_Click(object sender, EventArgs e) {
string uname;
string pwd;
uname = txt_user.Text;
pwd = txt_pass.Text;
string connetionString = null;
OleDbConnection connection;
OleDbDataAdapter oledbAdapter = new OleDbDataAdapter();
string sql = null;
connetionString = "Provider=SQLOLEDB;dsn=xe;User id=sa;password=password123";
connection = new OleDbConnection(connetionString);
sql = "DELETE * FROM Login WHERE username='" + uname + "' and password='" +pwd+ "'";
try
{
connection.Open();
oledbAdapter.DeleteCommand = connection.CreateCommand();
oledbAdapter.DeleteCommand.CommandText = sql;
oledbAdapter.DeleteCommand.ExecuteNonQuery();
Label4.Text = "deleted";
}
谢谢你