Hi All
Recently i got to do a project using InfoPath 2010. As per the requirements of the client, i had to use object model in InfoPath. I found many new things and learned frm mistakes and experience. I would like to share those with you.
1. If you want to connect to SQL Server using infopath programing, your form should be configured with fully trusted. For this, you have to go to Form Options-->Security-->Full trust.
2. Your validation will be ignored if you are using custom buttton for handling any business requirements. Then you should do small setting for the button. ie., goto button properties, select submit options, select form submit instead rules and programing. Also, click on Advanced button and you will see other advanced options when a button is clicked like close the form, stay on the form etc.,.
3. We cannot use global members directly in infopath 2010. You should use FormState property. while using this you may get doubt of how to use that for your required data type like string, int, etc., There is nothing tricky, give your required retur type for your member property and cast value to your required type while returning in get {} block. No need to do any thing in set {}.
4. There is no provision in code to assign value directly to integer, double, date, time & date & time. for this you need to delete an attribute. See below code which explains this.
---
public void DeleteNil(XPathNavigator node)
{
if (node.MoveToAttribute("nil", "http://www.w3.org/2001/XMLSchema-instance")) node.DeleteSelf();
}
----
once after doing this for the node, you can assign required value.
hmm, just taking a pause here. will continue rest of the things next, when i get free time.
thanks for reading..
thank you
raj