如何逐个从数据库中检索数据

编程入门 行业动态 更新时间:2024-10-27 16:31:14
本文介绍了如何逐个从数据库中检索数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

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

更多推荐

如何逐个从数据库中检索数据

本文发布于:2023-10-28 05:37:36,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1535684.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:数据库中   数据

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!