如何在sql server中显示asp.net中的记录 [英] how to display record in asp.net from sql server

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

问题描述

先生,

我在asp.net中用c#创建一个大学的网站,其中我想添加一个学生卷号的功能,当点击提交按钮时它会显示标记表/该学生的记录。

另外请告诉我应该在sql数据库中为此记录声明哪种类型的数据。

请尽快回复,因为我必须将我的项目提交给学院。我将非常感激你。谢谢。

Sir,
I create a website of a university in asp.net with c# in which i want to add a feature that takes student roll number and when click on submit button it will display the marksheet/record of that student.
Also please tell which type of data i should declare in sql database for this record.
Please reply as soon as possible because i have to submit my project to the college.I will be very gratefull to u. Thank You.

推荐答案

数据类型仅为字段定义,而不是为记录定义。例如,您可以考虑选择VARCHAR(20)作为RollNo的数据类型,选择INT作为Marks等。

要了解所有这些,您需要花一些时间阅读SQL Basics。

查看本教程 -

SQL教程 [ ^ ]



您还需要掌握技术知识像ADO.Net(忽略,如果你已经知道)让你的应用程序与数据库进行通信。

查看本教程 -

初学者用于理解ADO.NET的教程 [ ^ ]

http://www.tutorialspoint.com/asp.net/asp.net_ado_net。 htm [ ^ ] < br $> b $ b

希望,它有帮助:)
DataTypes are defined for fields only and not for the records. For example you may consider choosing VARCHAR(20) as data type for RollNo, INT for Marks etc.
To understand all these, you need to spend some time reading SQL Basics.
Check this tutorial-
SQL Tutorial[^]

You also need to have knowledge on technologies like ADO.Net (ignore if you already know) to make your application communicate to the database.
Check this tutorial-
A Beginner's Tutorial for Understanding ADO.NET[^]
http://www.tutorialspoint.com/asp.net/asp.net_ado_net.htm[^]

Hope, it helps :)


除了解决方案#1,

它可能是对你很紧迫,但不是对我们。来自这里的人们可以随时提供解决方案。你应该先自己尝试一些东西。如果你遇到一个特定的问题,那么当然可以在这里发布,但不要直接这样问问题。



这是一个快速的q / a论坛,阅读这10分 [ ^ ]。



现在解决您的问题 -

这是一个非常基本的问题,你可以从网上找到很多建议。将您的问题分解为较小的问题并尝试先解决它们。你的问题只有两件事要做 - 1. SELECT query& 2.在网页上渲染数据。



查询将是 - SELECT * FROM StudentTable WHERE RollNo = @rollNo

SELECT statment [ ^ ],您可以以表格格式显示返回的数据,也可以在网格中显示 - 无论您喜欢哪种格式。



参考此链接 -

SQL - 数据类型 [ ^ ]

ASP.NET Web窗体 - 数据库连接 [ ^ ]

连接到ASP.NET中的数据库 [ ^ ]

http ://www.aspsnippets.com/Articles/Display-data-from-database-in-HTML-table-in-ASPNet.aspx [ ^ ]

https://msdn.microsoft.com/en-us/library/tw738475.aspx [<一个href =https://msdn.microsoft.com/en-us/library/tw738475.aspx\"target =_ blanktitle =新窗口> ^ ]

< br $> b $ b

-KR
Apart from the solution #1,
It may be urgent to you, but not to us. People from here would provide solution whenever they can. And you should try something on your own at first. If you meet to a specific problem, then certainly can post it here, but don't directly ask question this way.

This is quick q/a forum, Read this 10 points[^] first before posting such question.

Now solution for your question-
This is a very basic question, you can find lots of suggestion from internet. Break down your problem into smaller ones and try to solve them first. Your question has only two things to do- 1. SELECT query & 2. Render data on webpage.

The query would be - SELECT * FROM StudentTable WHERE RollNo = @rollNo
SELECT statment[^], and you can show the returned data in Table format, or maybe in grid - whichever you like.

Refer this links-
SQL - Data Types[^]
ASP.NET Web Forms - Database Connection[^]
Connecting to Databases in ASP.NET[^]
http://www.aspsnippets.com/Articles/Display-data-from-database-in-HTML-table-in-ASPNet.aspx[^]
https://msdn.microsoft.com/en-us/library/tw738475.aspx[^]


-KR


这篇关于如何在sql server中显示asp.net中的记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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