We don't need the VSTA SDK to use VSTA in InfoPath 2007. We need some prerequisites and make a specific selection in setup:
The VSTA development environment is not installed by default when you choose Typical to install InfoPath. To install VSTA, you must either choose Customize when first installing, or use Add or Remove Programs to update your Office or InfoPath installation to include VSTA. The option to install VSTA is available by expanding Microsoft Office InfoPath, .NET Programmability Support, and .NET Programmability Support for .NET Framework version 2.0. The easiest way to do this, is to expand .NET Programmability Support, and then choose Run All From My Computer.
Testing:
On the InfoPath form 2007 click Button --> Edit Form Code and then start writing the code...
Ex:
//InfoPath SQL Database integration - accessing data from sql through Stored procedures in InfoPath
var serviceid = XDocument.DOM.selectSingleNode("/dfs:myFields/dfs:dataFields/d:titleauthor/@serviceid").text;
//Set the Command for the Query Adapter of the Data Source. Incorporate the
//parameter values that you want to use.
XDocument.QueryAdapter.Command = 'execute "dbo".""storedprocname" ' + serviceidValue;
//Query the Data Source.
XDocument.Query();
No comments:
Post a Comment