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