secondary data source query

T

tgingrich

I see many questions on this discussion board about doing queries on a
secondary data source, and many of the answers refer to a previous posting
titled "Secondary data source query". I cannot find this posting. Am I doing
something wrong, or has it been removed from the board? Is there any way I
can see the posting, since I am having similar problems with a secondary data
source?
 
T

tgingrich

Thanks, I was able to use the examples in that thread to add a where clause
to my secondary data source SQL. I'm still having one problem with it,
though. The first time the form is used, the where clause is generated
correctly. If the form is used again without exiting InfoPath, a second where
clause is appended to the first one resulting in a syntax error. Can you give
me an example of how to revert bacak to the original SQL statement prior to
adding the where?
 
S

S.Y.M. Wong-A-Ton

Save the original Command in a variable. Then after you run Query(), set the
Command back to the original SQL statement you saved in the variable.

So put something like the following at the beginning of the code but after
var strSQL = XDocument.DataObjects["PICCT_APPL"].QueryAdapter.Command; :

var strOrigSQL = strSQL;

Put the following after XDocument.DataObjects["PICCT_APPL"].Query(); :

XDocument.DataObjects["PICCT_APPL"].QueryAdapter.Command = strOrigSQL;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top