1
我運行此,我想以填補文本txtFname數據 - 但它不這樣做沒什麼如何從數據集中填充文本框?
using (Conn = new SqlConnection(Conect))
{
Conn.Open();
SQL = "SELECT * FROM MEN where id = '" + txtBAR.Text.Trim() + "'";
dsView = new DataSet();
adp = new SqlDataAdapter(SQL, Conn);
adp.Fill(dsView, "MEN");
adp.Dispose();
txtFname.Text = dsView.Tables[0].Rows[3][0].ToString();
txtFname.DataBind();
Conn.Close();
}
怎麼辦呢?
感謝的提前
也注意到,您的SQL是開放的SQL注入攻擊。你應該總是在你的命令中使用參數。 `select * from men where id = @ id` – 2010-11-28 20:09:40