<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.infopathdev.com:443/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>General</title><link>https://www.infopathdev.com:443/forums/41.aspx</link><description>If you're not sure where to ask your question, ask it here. If necessary, our moderators will make sure it gets classified in the correct board.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: query data source</title><link>https://www.infopathdev.com:443/forums/thread/6780.aspx</link><pubDate>Thu, 05 May 2005 19:20:36 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:6780</guid><dc:creator>Agni Jonnalagadda</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/6780.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=6780</wfw:commentRss><description>"Query data source" queries not only Database dataconnections, but also Webservice connections. So people might want to query a datasource once an action is performed For ex: when a button is clicked they might want to query a dataconnection, which gets data into a dataconnection. &lt;br /&gt;&lt;br /&gt;In your case you wanted to query a database to check whether the name exists in the database. Similarly someone else might want to populate a dropdown list based on another field value. In this instance once they query the dataconnection the data will populated into a dropdownlist.&lt;br /&gt;&lt;br /&gt;Hopefully this could have answered your question.&lt;br /&gt;&lt;br /&gt;Agni&lt;br /&gt;InfoPathDev India</description></item><item><title>Re: query data source</title><link>https://www.infopathdev.com:443/forums/thread/6779.aspx</link><pubDate>Thu, 05 May 2005 12:58:40 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:6779</guid><dc:creator>andywt</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/6779.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=6779</wfw:commentRss><description>Thanks for the code sample this was helpful.  I still don't understand the proper use of the "query data connection" action in a rule.  While you can query a specific source, what is the output of the query?  That is what is not clear to me.</description></item><item><title>Re: query data source</title><link>https://www.infopathdev.com:443/forums/thread/6778.aspx</link><pubDate>Tue, 03 May 2005 12:40:42 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:6778</guid><dc:creator>Agni Jonnalagadda</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/6778.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=6778</wfw:commentRss><description>Yes it is possible to check whether the query is successful or not, You need to check for the number of rows that the dataconnection XML has. &lt;br /&gt;For that you can use the "count()" method. For ex: It could be like this &lt;br /&gt;"count(xdXDocument:GetDOM("NameTable")/dfs:myFields/dfs:dataFields/d:Table)"&lt;br /&gt;&lt;br /&gt;Where "NameTable" is your secondary dataconnection name which points to your table.&lt;br /&gt;And you should specify a filter on the xpath to check for the row that you want to Insert.&lt;br /&gt;Now your total condition will be &lt;br /&gt;"count(xdXDocument:GetDOM("NameTable")/dfs:myFields/dfs:dataFields/d:TableName[@name = 'abcd']) &amp;gt; 0"&lt;br /&gt;&lt;br /&gt;If this condition is true then it means that there is a row in the table already, and if the condition return false then row is not there in the table.&lt;br /&gt;&lt;br /&gt;There is another way of doing this through the code,&lt;br /&gt;Write some code to change the Command that executes when you query a database&lt;br /&gt;&lt;br /&gt;ADOAdapterObject oNameTable = (ADOAdapterObject) thisXDocument.DataAdapters["NameTable"];&lt;br /&gt;oNameTable.Command = string.Format("Select * from tableName where name = '"+name+"'", sMemberId);&lt;br /&gt;oNameTable.Query();&lt;br /&gt;&lt;br /&gt;//After above code gets executed check how many rows are present in the data connection&lt;br /&gt;IXMLDomNodeList oNodeList = thisXDocument.GetDOM("NameTable").selectNodes("dfs:myFields/dfs:dataFields/d:TableName");&lt;br /&gt;Now if oNodeList.length is greater than "0" then the row is already present in the code. &lt;br /&gt;&lt;br /&gt;Hope this Helps!&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Agni&lt;br /&gt;InfoPathDev India</description></item><item><title>query data source</title><link>https://www.infopathdev.com:443/forums/thread/4643.aspx</link><pubDate>Mon, 02 May 2005 16:08:36 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:4643</guid><dc:creator>andywt</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/4643.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=4643</wfw:commentRss><description>I'm a bit confused.  In the rules box of a conttrol, I see that I can query a data source.  My confusion is I do I use the result?  When you do a query is it possible to determine if it succeed or not?&lt;br /&gt;&lt;br /&gt;I'm using Infopath to maintain a simple database.  When the key field is entered, I want to query and see if the key has been previously entered.  If so, populate the form with values that can be edited.  If not, skip the prepopulate.  Have I missed something so very obvious?</description></item></channel></rss>