问题描述
我想根据leavetype和emp id在textbox1中显示emp leave balance。我正在使用下面的代码,但它没有在文本框中显示总休假余额。
请帮助。
private void cbleavetype_SelectedIndexChanged()
{
conn = new SqlConnection(@Data Source = ........)
conn.Open();
SqlCommand command = new SqlCommand(select leave leave from leaveallotment where id ='+ comboBox1.Text +'and leavetype ='+ cbleavetype.Text +',conn);
SqlDataAdapter adp = new SqlDataAdapter(command);
DataTable tbl = new DataTable();
adp.Fill(tbl);
textBox1.Text = cbleavetype.SelectedValue.ToString();
}
I want to show emp leave balance in textbox1 based on leavetype and emp id. I'm using below code but it's not showing total leave balance in textbox.
please help.
private void cbleavetype_SelectedIndexChanged()
{
conn = new SqlConnection(@"Data Source=........")
conn.Open();
SqlCommand command = new SqlCommand("select leave from leaveallotment where id='" + comboBox1.Text + "' and leavetype='" + cbleavetype.Text + "'",conn);
SqlDataAdapter adp = new SqlDataAdapter(command);
DataTable tbl = new DataTable();
adp.Fill(tbl);
textBox1.Text = cbleavetype.SelectedValue.ToString();
}
这篇关于如何根据leavetype和emp id在textbox1中显示emp离开余额的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!