|
Still not good, I wrote it like this
OleDbConnection con = new OleDbConnection ("server = hp; uid = sa; pwd = sa; database = test; Provider = SQLOLEDB");
string sql = "select * from members where userName = @ userName";
OleDbCommand cmd = new OleDbCommand (sql, con);
con.Open ();
// Prevent injection attacks
cmd.Parameters.Add ("@ userName", OleDbType.VarChar, 50);
cmd.Parameters ["@ userName"]. Value = this.TextBox1.Text.Replace ("'", "");
The value of sql is still select * from members where userName = @ userName
Where is wrong? Urgent ~ |
|