我有两个文本框Textbox1
和Textbox2
。我想根据textbox1值在textbox2中带一些值。我有一个查询
protected void TextBox1_TextChanged(object sender, EventArgs e)
{
string str="select TimeIn from Employee where Date='"+txtdate.text+"'";
Sqldatreader dr=conn.query(str);
if(dr.Read())
{
Textbox2.text=dr[0].Tostring();
}
}
答案 0 :(得分:0)
private void textBox1_TextChanged(object sender, EventArgs e)
{
textBox2.Text = textBox1.Text;
}
答案 1 :(得分:0)
您必须更改AutoPostBack= True
的属性TextBox1
,然后将其作为
private void textBox1_TextChanged(object sender, EventArgs e)
{
textBox2.Text = textBox1.Text;
}
答案 2 :(得分:0)
string SelectCustomerBalance = "Select cbalance FROM customer where cname = '" +
searchLookUpEdit1.Text + "'";
con.Open();
SqlCommand cmd = new SqlCommand(SelectCustomerBalance, con);
SqlDataReader datareader = cmd.ExecuteReader();
// con.Close();
if (datareader.Read())
{
txtcustomercurrentBlnc.Text = datareader["cbalance"].ToString();
}