如何逐个从数据库中检索数据 [英] How to retrieve data from database one by one

查看:68
本文介绍了如何逐个从数据库中检索数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HI,即时开发一个简单的CRM。



在这里我必须逐个从数据库中检索数据。有两个表,t1包含4个字段和t2包含8个字段。我使用数据阅读器,但它给了我任何行(主要是最后一行),我希望行逐个连续出现。我想要的是最初第一行应该出现然后它的值应该填充4个文本框,除上述文本框外,还有4个空白文本框,这些文本框应在稍后填写,然后通过提交按钮提交。这8个字段的新数据存储在表t2中。那么来自t1的下一个数据应该出现在前4个文本框中,剩下的文本框将被填充,这些数据应该通过提交按钮提交。它必须以这种方式运行,直到t1的整个数据被发送到t2。 PLZ帮助我.....我想尽快解决它.....



提前致谢....

解决方案

您不必逐个获取行,使用您选择的SQL查询获取 Datatable ,然后迭代C#中的行使用 foreach 关键字。



干杯,

Edo

HI, i m developing a simple CRM.

In this i have to retrieve data from database one by one.There are two tables, t1 contain 4 fields and t2 contain 8 fields. I m using data reader but it gives me any row(mostly the last row), i want the rows to appear serially, one by one.what i want is that initially 1st row should appear then its values should filled in 4 text boxes, there are 4 blank text boxes except the above one and these should be filled later and then it is submitted through a submit button. this new data of 8 fields is stored in table t2. then the next data from t1 should appear in first 4 text boxes and remaining text boxes are filled and this data should be submitted through submit button. it must run in this way until the whole data of t1 is sent to t2. plz help me..... i want to solve it asap.....

Thanks in advance....

解决方案

You don't have to get the rows one by one, get a Datatable using the SQL query of your choice and then iterate through the rows in C# using the foreach keyword.

Cheers,
Edo


这篇关于如何逐个从数据库中检索数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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