I am using this code in jscript to get info from a secondary datasource:
var YeastStoragedom = XDocument.GetDOM("YeastStorageStateID");
YeastStoragedom.setProperty("SelectionNamespaces",'xmlns:dfs = "http://schemas.microsoft.com/office/infopath/2003/dataFormSolution" xmlns:d = "http://schemas.microsoft.com/office/infopath/2003/ado/dataFields"');
var YeastStorage = YeastStoragedom.selectSingleNode("dfs:myFields/dfs:dataFields/d:VesselState/@VesselStateID").text;
delete YeastStoragedom;
The YeastStorageStateID query returns only one row, and YeastStorage is set to an integer identifier for the vessel state Yeast Storage, which happens to equal 6.
I later adjust my main connection query to return only vessels with this state ID. So far, all this code works. I can search for only this ID, or for all ID's without trouble.
The search populates a Master/Detail table in my Infopath form, and the problem comes when I try click on different entries in the master table. After clicking between several different entries, especially if I click quickly, Infopath crashes. The error signature looks like this:
AppName: infopath.exe AppVer: 11.0.8165.0 AppStamp:46365a13
ModName: mshtml.dll ModVer: 7.0.6000.16788 ModStamp:494358c0
fDebug: 0 Offset: 00216eac
Then an Application Error dialogue box pops up that says:
The instruction at "0x437e6eac" referenced memory at "0x00000000". The memory could not be "read".
If I hardwire the query in my code, excluding vessels that do not have a State ID equal to 6, and take out the code above, Infopath does not crash. However, if I keep the code in, even if I keep the query hardwired and never use the variable YeastStorage again, the program crashes. It also crashes without the "delete YeastStoragedom;" line; I just put that in to see if it would fix the problem.
What am I doing wrong?