如何在Label4中显示学生姓名 [英] how to display the student name in the Label4

查看:70
本文介绍了如何在Label4中显示学生姓名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Studetn id txt_student(文本框)显示(按钮)



Label4



i想显示label2中的学生姓名。



当我点击显示按钮时,输出将显示在Gridview中。



显示按钮代码如下;



Studetn id txt_student(textbox) Show (Button)

Label4

i want to display the student name in the label2.

when i click the show button the output will display in the Gridview.

Show Button code as follows;

SQl = "SELECT S.StudetnName,S.Marks, S.QPName,B.Class,B.BthNo,B.Batchdate,B.Attender FROM STUDDET S,Batch B ";
SQl = SQl + " where S.BthId = B.BthId and  s.StudId = ''" + txt_Studid.Text.ToString() + "''";
        try
        {
            Dr = SCon.ReadSql(SQl);
            this.GridView1.DataSource = Dr;
            this.GridView1.DataBind();
            Dr.Close();
        }
        catch (Exception e1)
        {
            Label4.Text = e1.Message.ToString();
            return;
        }



输出如下;



标记QPName Class BthNo Batchdate Attender

56 REO_2011 REO 37 2011-09-26 NIRANJAN

64 REO_2011 REO 37 2011-09-26 NIRANJAN



以上输出正确检索,但我想在Label4中显示学生姓名。







for我该怎么办,如何在Label4中显示学生姓名。



请帮助我。



问候,

Narasiman P.


Output as follows;

Marks QPName Class BthNo Batchdate Attender
56 REO_2011 REO 37 2011-09-26 NIRANJAN
64 REO_2011 REO 37 2011-09-26 NIRANJAN

the above output is retrieving correctly, but i want to display the student name in the Label4.



for that how can i do, how to display the student name in the Label4.

Please help me.

Regards,
Narasiman P.

推荐答案

你正在使用try catch错误,请参阅这个。 [ ^ ]只有在应用程序抛出异常时才会显示Label4。查看文章以了解try catch是什么。
You are using a try catch wrong, see this.[^] Label4 will only get displayed if your application throws an exception. Review the article to understand what a try catch is.


这篇关于如何在Label4中显示学生姓名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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