Hi KjellSJ,
thanks so much. I think we are very close to my solution. The code now looks
like this ( I have to admit that I am not too much into coding yet)
Now I get the message every time a query is executed.
Thanks in advance for helping me again.
Kind regards
Lidschi.
function btnQuery::OnClick(eventObj)
{
// Write your code here
try
{
var loadDataSource = "Primäre Verbindung";
//call the Query method of the primary data source to load the data
XDocument.DataAdapters(loadDataSource).Query();
eventObj.ReturnStatus = true;
}
catch(ex)
{
XDocument.UI.Alert("Failed while loading from web service.\r\n");
eventObj.ReturnStatus = false;
}
//query completed, count number of rows returned
var nodeList =
XDocument.DOM.selectNodes("/dfs:myfields//d:q_view_resources_europe");
if(nodeList.length==0)
{
XDocument.UI.Alert("No results, user name or password is wrong!");
}
}
> If zero records returned always means that the user name or password is
> wrong, then count the number of rows in your table after the query and show
[quoted text clipped - 63 lines]
> > > > Kind regards
> > > > Lidschi.
KjellSJ - 01 May 2005 09:41 GMT
First of all, move the code below the try-catch block to just after the
.Query() line.
Then insert the debugger statement before the .selectNodes() line:
//call the Query method of the primary data source to load the data
XDocument.DataAdapters(loadDataSource).Query();
//BREAK INTO THE DEBUGGER, INSPECT XML USING IMMEDIATE WINDOW
debugger
//query completed, count number of rows returned
var nodeList =
XDocument.DOM.selectNodes("/dfs:myfields//d:q_view_resources_europe");
if(nodeList.length==0)
{
XDocument.UI.Alert("No results, user name or password is wrong!");
}
eventObj.ReturnStatus = true;
Save the script. Run the form and click your query button. Use the immediate
window in the debugger to check the content of the returned XML:
? XDocument.DOM.xml
Check carefully that your XPath has the correct namespace prefixes.
Also note that my example code queries a web service, check the InfoPath SDK
for details about querying a SQL Server datasource.
KjellSJ
> Hi KjellSJ,
>
[quoted text clipped - 101 lines]
> > > > > Kind regards
> > > > > Lidschi.