I have a problem with connecting to Excel as an ODBC source.
Problems:
If connection to Excel has been made and an attempt is made to send an email, Adobe will crash with no error.
Also if i start with sending an email with Adobe, a connection to Excel as an ODBC source can not be opened.
These errors does not happen when using an sql server as an ODBC source.
I tried a lot of different approaches, but i am not able to solve it. Everything is updated to the latest versions.
Working Code, but crashes Adobe when trying to send email.
//Open ODBC connection to Excel Sheet named "Item". Connection Name: "Fuel-Item"
try {
var nIndex = 0;
while(xfa.sourceSet.nodes.item(nIndex).name != "Fuel-Item"){nIndex++;}
var oDB = xfa.sourceSet.nodes.item(nIndex).clone(1);
oDB.nodes.item(1).query.setAttribute("text", "commandType");
sBOFBackup = oDB.nodes.item(1).query.recordSet.getAttribute("bofAction");
sEOFBackup = oDB.nodes.item(1).query.recordSet.getAttribute("eofAction");
oDB.nodes.item(1).query.recordSet.setAttribute("stayBOF", "bofAction");
oDB.nodes.item(1).query.recordSet.setAttribute("stayEOF", "eofAction");
oDB.nodes.item(1).query.select.nodes.item(0).value = "SELECT Description FROM [Item]";
oDB.open();
//Read records
oDB.nodes.item(1).query.recordSet.setAttribute(sBOFBackup, "bofAction");
oDB.nodes.item(1).query.recordSet.setAttribute(sEOFBackup, "eofAction");
oDB.close();
}catch(err){
xfa.host.messageBox("Error\n\n"+err, "Debugging", 3);
}
//Send mail
var cTo="casper.v.thomsen@wennstrom.com";
var cSubject="Hello";
var cMsg="World";
event.target.submitForm({cURL:"mailto: "+ cTo +"?subject=" + cSubject+"&body=" + cMsg,cSubmitAs:"PDF",cCharset:"utf-8"});