显示表中的值 [英] Display value from tables

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

问题描述


我有这些桌子
学校-(SchoolID,SchoolName,城市,电话,说明)
程序-(ProgramID,ProgramName)
课程-(CouseID,CourseName)
SCHOOL_PROGRAM_COUSRE-(课程ID,学校ID,程序ID,课程费用,学校课程名称)
类别-(CategoryID,CategoryName)

现在我要显示-
SchoolName
CourseName
CourseFee
CategoryName

我已经完成了存储过程,现在只想将这些值显示为在不同"LABELS"或文本框"中的输出.该怎么做?

谢谢.

解决方案


如果您的存储过程返回了多个记录,即多个学校名称,则可以使用带有标签或Texboxes作为项目模板的GridView.或者,如果您的过程仅返回一条记录,则可以使用4个单独的标签或文本框.

检查一下.
http://msdn.microsoft.com/en-us/library/aa479353.aspx [ ^ ]

http://www. asp.net/web-forms/tutorials/data-access/custom-formatting/using-templatefields-in-the-gridview-control-cs [ C#DataGridView教程 [
Thanks.

解决方案

Hi,
if your stored procedure is returning multiple record i.e multiple school names, you can go for GridView with labels or Texboxes as item templates. Or if your procedure returning only one record then you can use 4 individual labels or textboxes.

check this.
http://msdn.microsoft.com/en-us/library/aa479353.aspx[^]

http://www.asp.net/web-forms/tutorials/data-access/custom-formatting/using-templatefields-in-the-gridview-control-cs[^]


The question is not tagged with either Windows Forms or ASP.NET and it could not be made out from the question also.

The Solution 1 given by Karthik Harve is good for ASP.NET.

For Windows Forms DataGridView control can be used for displaying the results.
A tutorial is given here
C# DataGridView Tutorial[^]


这篇关于显示表中的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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