什么是载体呀?我是新手唉,就是一个查询,我查询个姓名,然后这个人的其他信息业就都出来了,,而且我不想用控件,现在查询只能显示姓名,不知道怎么回事
protected void Button1_Click(object sender, EventArgs e)
{
if (TextBox1.Text == "")
{
Response.Write("alert('请输入要查询的内容!')");
}
else
{
SqlConnection con = new SqlConnection();
;
con.ConnectionString = "Data Source=.;Initial Catalog=test;user=sa;pwd=server;Integrated Security=True";
con.Open();
String selectStaff = "select Name from Staff where Name='" + TextBox1.Text.Trim() + "'";
SqlCommand cmd = new SqlCommand(selectStaff,con);
SqlDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{
Response.Write(dr[0].ToString());
}