con.Open();
string deletee = "DELETE FROM tbl_users WHERE usernaem = '" + txtusername.Text + "'and password = '" + txtPassword.Text + "'";
SqlDataAdapter da = new SqlDataAdapter("SELECT * FROM tbl_users",con);
da.Fill(ds);
SqlDataAdapter da2 = new SqlDataAdapter(deletee, con);
da2.Fill(ds2);
if (ds.Equals(ds2) == true)
{
MessageBox.Show("You are not user...", "Delete failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
txtusername.Text = "";
txtPassword.Text = "";
txtComPassword.Text = "";
}
I'm trying to make "Account delete system." and this is part of my code.
Starting from the line 97, I opened sql data and connected to two SqlData Adapter(da, da2), and i filled two DataSet(ds, ds2) with SqlDatas.
As you can see the line 103, I inserted command that can delete some data.
But even though I wrote wrong username and password, ds.Equals(ds2) == true doesnt work(if i put wrong username and password, delete command does not work so ds and ds2 have to be same).
why this code does not work? and is there any other ways to compare two dataset or table?
I'm South Korean so my english is pretty bad. sorry for that.