将记录从数据库导入到应用程序变量 [英] Import records from database to application variables

查看:65
本文介绍了将记录从数据库导入到应用程序变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

现在,这要么太简单,任何人都无法问到,要么它是不可能的,因为我一直在搜寻google,只能找到其他方法(即,将数据发送到数据库)

我想将每一行中的每个字段导入到特定的文本框中,但是我一生都无法解决.当然,这很简单吗?

抱歉,如果这是一个极其简单的解决方案,并且我是布偶,但请先感谢您的帮助

Hello all,

Now this is either too simple to be asked by anyone, or its impossible, as ive been trawling google and can only find how to do it the other way around (i.e. send data TO a database)

I want to import each field in each row into a specific text box, but cannot for the life of me work it out. Suuuuurely this is fairly simple to do?

Sorry if it is a horrifically simple solution and im being a muppet, but thanks in advance for any help

推荐答案

因此,如果您对数据表进行查询,类似
So if you do a query into a datatable, something like
SELECT * FROM MyTable


您将基本上获得一个行集合,每行上的列数相同.如果现在遍历行和列"集合并将值添加到文本框的数组中,那行不通吗? (伪)之类的东西:


you will get basically a collection of rows with same amount of columns on each row. If you now loop through the Rows and Columns collections and add the values to an array of textbox''s, wouldn''t that work? Something like (pseudo):

Fill a datatable with a query
foreach datatable.row {
   foreach datatable.column {
      textboxlist.add(new textbox() {Text = Row.Column.Value })
   }
}
Place the textboxes to the form


这篇关于将记录从数据库导入到应用程序变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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