iam尝试在“查找"按钮上查找记录,但没有任何人告诉我 [英] iam trying to find record on find button but it is not getting any one tell me
本文介绍了iam尝试在“查找"按钮上查找记录,但没有任何人告诉我的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我的代码.........在查找"按钮上单击事件
this is my code......... on find button click event
private void btnfind_Click(object sender, EventArgs e)
{
try
{
rec = ds.Tables[0].Select("Enm.Id=" + txtemp.Text)[0];
txtname.Text = rec[1].ToString();
txtdesg.Text = rec[2].ToString();
txtdoj.Text = rec[3].ToString();
txtsal.Text = rec[4].ToString();
txtdept.Text = rec[5].ToString();
cmdupdate.Enabled = true;
}
catch
{
MessageBox.Show("Record not found");
}
推荐答案
对于DataTable
类的Select
方法,在FilterExpression
条件下的Text应该用单引号引起来.因此,将单引号放在select方法中,如下所示
For theSelect
method ofDataTable
class, the Text in the condition ofFilterExpression
shall be enclosed in single quotes. Hence, put single quotes in the select method as shown below
rec = ds.Tables[0].Select("Enm.Id='" + txtemp.Text + "'")[0];
如果您的问题得到解决,您可以投票并接受解决方案,否则,请发布您的查询
You may vote and accept the solution if your problem is solved, otherwise please post your queries
这篇关于iam尝试在“查找"按钮上查找记录,但没有任何人告诉我的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文