如何从同一列中一张一张地从数据库中获取数据 [英] how to fetch data from database one by one from same column
本文介绍了如何从同一列中一张一张地从数据库中获取数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有问题
在我的网站上,当我运行查询时,该查询将获取三个记录.
我希望在for循环中逐个获取记录
请帮我它的紧急情况
I have a problem
In my website,when i run the query.then there are three records fetch by the query.
I wish to fetch the record one by one inside a for loop
.Please Help me Its Urgent
推荐答案
对于简单的DB操作,您可以使用ASP .NET Dynamic数据.快速参考,网址为: http://weblogs. asp.net/scottgu/archive/2007/12/14/new-asp-net-dynamic-data-support.aspx [
For simple DB operation, you can use ASP .NET Dynamic data. Quick reference at: http://weblogs.asp.net/scottgu/archive/2007/12/14/new-asp-net-dynamic-data-support.aspx[^]
请参阅我对这个问题的评论.
看来您需要使用数据读取器.请参阅: http://msdn.microsoft.com/en-us/库/haa3afyz%28v=VS.100%29.aspx [SELECT语句中提及一个列名.
另请参见此精美易懂的CodeProject文章:为初学者使用ADO.NET [ ^ ].
-SA
Please see my comment to the question.
It looks like you need to use a data reader. See: http://msdn.microsoft.com/en-us/library/haa3afyz%28v=VS.100%29.aspx[^].
"From the same column" simply means that you need to mention only one column name in yourSELECT
statement.
See also this nice and easy-to-understand CodeProject article: Using ADO.NET for beginners[^].
—SA
您可以在SqlCommandObject上使用ExecuteReader()来逐一读取特定列中的数据.
http://www.csharp-station.com/Tutorial/AdoDotNet/Lesson04 [ ^ ]
You can use ExecuteReader() on SqlCommandObject to read the data from a particular column one by one.
http://www.csharp-station.com/Tutorial/AdoDotNet/Lesson04[^]
这篇关于如何从同一列中一张一张地从数据库中获取数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文