使用 SQL 数据库预填充 InfoPath
我正在创建一个 InfoPath 表单并希望从 SQL 数据库检索数据。我并不是在寻找最终用户填写空白文本字段,而是只想使用 SQL 数据库中的数据填充字段。
我在一些博客和 InfoPath/Microsoft 网站上进行了搜索,以了解如何实现这一点,但我不断遇到的许多内容都显示了如何创建最终用户可以填充的字段,而不是预先填充的字段。
我已经将我想要使用的数据库连接到 InfoPath,并且“myfields”已经填充了我正在使用的表,所以成功了一半! :)
我怎样才能做到这一点?
I am creating an InfoPath form and want to retrieve the data from the SQL database. 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.
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.
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! :)
How can I accomplish this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有几个选项可供您使用...
首先,您可以考虑在 InfoPath 表单字段中使用表单加载规则或默认值,以使用 SQL(辅助)数据源中的数据填充字段...看看这个链接:http: //social.technet.microsoft.com/Forums/en/sharepoint2010customization/thread/cb15a237-28cc-4d6b-8225-83181a7497ff
其次,您可以在表单加载上使用托管代码来查询 SQL 数据库,然后设置您的返回值与 InfoPath 表单中字段中保存的值相同。请在此处查看如何使用托管代码来执行此操作:http://vspug.com/ssa/2006/01/03/populate-infopath-fields-with-sql-data-using-management-code/
我希望这有帮助...
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
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. 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/
I hope this helps...