简体   繁体   English

使用SQL数据库预填充InfoPath

[英]Pre-Populating InfoPath using SQL Database

I am creating an InfoPath form and want to retrieve the data from the SQL database. 我正在创建一个InfoPath表单,并希望从SQL数据库中检索数据。 I'm not looking for end users to fill in blank text fields, but rather am just wanting to populate the fields with the data from the SQL Database. 我不是在寻找最终用户填写空白文本字段,而只是想用SQL数据库中的数据填充字段。

I have searched on some blogs and InfoPath/Microsoft sites to see how this can be accomplished, but many of the things I keep bumping into show how to create fields that the end user can populate instead of fields that are pre-populated. 我搜索了一些博客和InfoPath / Microsoft网站,看看如何实现这一点,但我不断碰到的许多内容都展示了如何创建最终用户可以填充的字段而不是预先填充的字段。

I have already connected the database that I want to use to InfoPath and 'myfields' are already populated with the table that I am using, so half the battle has been won! 我已经将我想要使用的数据库连接到InfoPath,并且'myfields'已经填充了我正在使用的表,所以赢得了一半的战斗! :) :)

How can I accomplish this? 我怎么能做到这一点?

There are a few options available to you... 您可以选择几种选择......

Firstly, you can look at using rules on the form load or default vlues in your InfoPath forms' fields to populate the fields with data from your SQL (secondary) data source... Take a look at this link here: http://social.technet.microsoft.com/Forums/en/sharepoint2010customization/thread/cb15a237-28cc-4d6b-8225-83181a7497ff 首先,您可以查看在InfoPath表单字段中使用表单加载或默认线索的规则,使用SQL(辅助)数据源中的数据填充字段...请在此处查看此链接: http:// social.technet.microsoft.com/Forums/en/sharepoint2010customization/thread/cb15a237-28cc-4d6b-8225-83181a7497ff

Secondly, you could use managed code on the form load to query the SQL database and then set your returned values to the values held in your fields in your InfoPath form. 其次,您可以在表单加载上使用托管代码来查询SQL数据库,然后将返回的值设置为InfoPath表单中字段中保存的值。 Take a look here for using managed code to do this: http://vspug.com/ssa/2006/01/03/populating-infopath-fields-with-sql-data-using-managed-code/ 看看这里使用托管代码执行此操作: http//vspug.com/ssa/2006/01/03/populating-infopath-fields-with-sql-data-using-managed-code/

I hope this helps... 我希望这有帮助...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM