字段不填充? [英] Fields don't Populate ?

查看:87
本文介绍了字段不填充?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的所有人,



我在运行时编写以下代码,从数据库中检索字段,但不分配给它的文本字段是否错误。



这是我的代码。





Dear All ,

I am writing the following code at run time it retrieve the fields from data base but do not assign to the text fields whats wrong with it.

Here is my code .


protected void btnSearch_Click(object sender, EventArgs e)
       {
           int sno=int.Parse(txtStID.Text.ToString());

           ResultDbContext rc = new ResultDbContext();
           TblResult res=rc.TblResults.ToList().Where(x=>
           x.StID==int.Parse(txtStID.Text)).First();


           if ((res.Class == "XI") && (res.SGroup == "Pre-Engineering"))
         {
             txtName.Text = res.SName;
             txtFName.Text = res.FName;
             txtClass.Text = res.Class;
             txtSGroup.Text = res.SGroup;
             txtEng1.Enabled = true;
             txtEng1.Text = res.Eng1.ToString();
             txtUrdu1.Enabled = true;
             txtPhy1.Text = res.Phy1.ToString();
             txtChem1.Enabled = true;
             txtChem1.Text = res.Chem1.ToString();
             txtMath1.Enabled = true;
             txtMath1.Text = res.Math1.ToString();

         }
        }

推荐答案

我们无法运行您的代码所以没办法让我们知道出了什么问题。您正在为Text属性分配值,以便部分正常。但是,您必须调试自己的代码,因为我们无法运行它。也许res.Class不等于XI或者res.SGroup!=Pre-Engineering或res.SName是空白的。我们无从知晓。你必须调试它。
We cannot run your code so there is no way for us to know what is wrong. You are assigning values to the Text property so that part is OK. However, you'll have to debug your own code since we can't run it. Perhaps res.Class does not equal "XI" or perhaps res.SGroup != "Pre-Engineering" or res.SName is blank. There is no way we can know. You have to debug it.


这篇关于字段不填充?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆