很简单啊,你自己试试没? System.Data.SqlClient.SqlConnection cn = new System.Data.SqlClient.SqlConnection("连接字符串"); cn.Open(); System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand("select xx from table where id=xx",cn); TextBox1.Text = cmd.ExecuteScalar().ToString();
{
string id=获取id;
Form a=new form(id);
a.ShowDialog();
}a 窗口 /// <summary>
/// 构造函数
/// </summary>
/// <param name="_model">患者基本信息</param>
public a( string _id)
{
InitializeComponent();
id=_id;
} private string id; private void a_Load(object sender, EventArgs e)
{
string name=通过id查找name;
textbox.text=name;
}
B--> Load: txtBox1.text = request.QueryString["id"];
System.Data.SqlClient.SqlConnection cn = new System.Data.SqlClient.SqlConnection("连接字符串");
cn.Open();
System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand("select xx from table where id=xx",cn);
TextBox1.Text = cmd.ExecuteScalar().ToString();