<?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>Newbie Questions</title><link>https://www.infopathdev.com:443/forums/39.aspx</link><description>New to InfoPath? Search to see if your question has already been answered. If it has not, then ask it here or the appropriate topic forum.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: Wildcard query when a relationship exists between two tables</title><link>https://www.infopathdev.com:443/forums/thread/60266.aspx</link><pubDate>Wed, 13 Oct 2010 02:56:26 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:60266</guid><dc:creator>Jimmy</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/60266.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=60266</wfw:commentRss><description>&lt;p&gt;You&amp;nbsp; need to construct your SQL query in a manner that is syntactically correct.&amp;nbsp; In this case, it looks like just tacking a WHERE clause on the end of the default SQL statement&amp;nbsp;isn&amp;#39;t going to work.&amp;nbsp; Why don&amp;#39;t you figure out what the entire query is supposed to be and use that instead?&lt;/p&gt;</description></item><item><title>..</title><link>https://www.infopathdev.com:443/forums/thread/60246.aspx</link><pubDate>Tue, 12 Oct 2010 19:44:07 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:60246</guid><dc:creator>Desmo</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/60246.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=60246</wfw:commentRss><description>&amp;lt;moved to different thread&amp;gt;&lt;br /&gt;</description></item><item><title>Re: Wildcard query when a relationship exists between two tables</title><link>https://www.infopathdev.com:443/forums/thread/37673.aspx</link><pubDate>Mon, 26 Jan 2009 17:41:46 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:37673</guid><dc:creator>RichardA</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/37673.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=37673</wfw:commentRss><description>&lt;font size="2"&gt;
&lt;p&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;Here you go.&amp;nbsp; I hope it makes sense.&amp;nbsp; I am using VB.NET in VSTA to process the Clicked event for a button.&amp;nbsp; I&amp;#39;m not an all-star coder myself so there are probably better ways but this works.&amp;nbsp; Regards, Rich&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&lt;/font&gt;&lt;/font&gt;&amp;nbsp;&lt;/p&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;Public&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;Sub&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; CTRL379_7_Clicked(&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;ByVal&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; sender &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;As&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;Object&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;, &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;ByVal&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; e &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;As&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; ClickedEventArgs)&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;Const&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; Quote &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;As&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;Char&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; = &lt;/font&gt;&lt;font color="#800000" size="2"&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;&amp;quot;&amp;quot;c&amp;quot;&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;
&lt;p&gt;&lt;/font&gt;&lt;font color="#008000" size="2"&gt;&lt;font color="#008000" size="2"&gt;&amp;#39;Create an XPathNavigator that looks at the Casing Name&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;Dim&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; NewQueryNav &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;As&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; XPathNavigator = _&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;CreateNavigator().SelectSingleNode(&lt;/font&gt;&lt;font color="#800000" size="2"&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;/dfs:myFields/dfs:queryFields/q:CasingModelData/@CasingName&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;, _&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;NamespaceManager)&lt;/p&gt;
&lt;p&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;Dim&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; CasingNam &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;As&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;String&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;
&lt;p&gt;CasingNam = NewQueryNav.InnerXml&lt;/p&gt;
&lt;p&gt;&lt;/font&gt;&lt;font color="#008000" size="2"&gt;&lt;font color="#008000" size="2"&gt;&amp;#39;This line sets the CasingName element to null so it is not included in the filter.&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;
&lt;p&gt;NewQueryNav.InnerXml = &lt;/font&gt;&lt;font color="#800000" size="2"&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;&amp;quot;&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;
&lt;p&gt;&lt;/font&gt;&lt;font color="#008000" size="2"&gt;&lt;font color="#008000" size="2"&gt;&amp;#39;Create an XPathNavigator that looks at the query connection.&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;Dim&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; xpQueryNav &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;As&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; XPathNavigator = _&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;CreateNavigator().SelectSingleNode(&lt;/font&gt;&lt;font color="#800000" size="2"&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;/dfs:myFields/dfs:queryFields&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;, _&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;NamespaceManager)&lt;/p&gt;
&lt;p&gt;&lt;/font&gt;&lt;font color="#008000" size="2"&gt;&lt;font color="#008000" size="2"&gt;&amp;#39;Instantiate the query connection&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;Dim&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; myAdoQueryConnection &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;As&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; AdoQueryConnection = &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;Me&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;.DataConnections(&lt;/font&gt;&lt;font color="#800000" size="2"&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;Casing Risk Data&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;)&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;Dim&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; strOldCommand &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;As&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;String&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;
&lt;p&gt;&lt;/font&gt;&lt;font color="#008000" size="2"&gt;&lt;font color="#008000" size="2"&gt;&amp;#39;Get the existing command being used to retrieve data&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;
&lt;p&gt;strOldCommand = myAdoQueryConnection.Command&lt;/p&gt;
&lt;p&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;Dim&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; strNewCommand &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;As&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;String&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;
&lt;p&gt;&lt;/font&gt;&lt;font color="#008000" size="2"&gt;&lt;font color="#008000" size="2"&gt;&amp;#39;This line adds a where clause to the command that will filter the results.&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;strNewCommand = strOldCommand.Replace(&lt;/font&gt;&lt;font color="#800000" size="2"&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;as [CasingModelData]}&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;, _&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;&lt;/font&gt;&lt;font color="#800000" size="2"&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;as [CasingModelData] WHERE CasingName LIKE &amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &amp;amp; Quote &amp;amp; CasingNam &amp;amp; Quote &amp;amp; &lt;/font&gt;&lt;font color="#800000" size="2"&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;}&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;)&lt;/p&gt;
&lt;p&gt;&lt;/font&gt;&lt;font color="#008000" size="2"&gt;&lt;font color="#008000" size="2"&gt;&amp;#39;MessageBox.Show(strNewCommand)&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;
&lt;p&gt;myAdoQueryConnection.Command = strNewCommand&lt;/p&gt;
&lt;p&gt;myAdoQueryConnection.Execute()&lt;/p&gt;
&lt;p&gt;myAdoQueryConnection.Command = strOldCommand&lt;/p&gt;
&lt;p&gt;NewQueryNav.InnerXml = CasingNam&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;End&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;Sub&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;</description></item><item><title>Re: Wildcard query when a relationship exists between two tables</title><link>https://www.infopathdev.com:443/forums/thread/37670.aspx</link><pubDate>Mon, 26 Jan 2009 16:59:32 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:37670</guid><dc:creator>gdgonzal</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/37670.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=37670</wfw:commentRss><description>&lt;p&gt;Thanks for your help Richard, but I&amp;#39;m afraid I&amp;#39;m not well versed in coding.&amp;nbsp; What typically helps me is if I can see the code in context.&amp;nbsp; Is there anyway you could post your entire code syntax rathen than snippets?&amp;nbsp; Perhaps then I can get a better understanding on how to apply it, thanks.&lt;/p&gt;</description></item><item><title>Re: Wildcard query when a relationship exists between two tables</title><link>https://www.infopathdev.com:443/forums/thread/37669.aspx</link><pubDate>Mon, 26 Jan 2009 16:57:17 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:37669</guid><dc:creator>gdgonzal</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/37669.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=37669</wfw:commentRss><description>&lt;p&gt;I get the exact same error as before...thanks.&lt;/p&gt;</description></item><item><title>Re: Wildcard query when a relationship exists between two tables</title><link>https://www.infopathdev.com:443/forums/thread/37668.aspx</link><pubDate>Mon, 26 Jan 2009 16:29:54 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:37668</guid><dc:creator>RichardA</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/37668.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=37668</wfw:commentRss><description>&lt;p&gt;Not that you asked, but with my wildcard search, I used a constant to provide the double quotes (this is in VB.NET):&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;
&lt;p&gt;Const&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; Quote &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;As&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;Char&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; = &lt;/font&gt;&lt;font color="#800000" size="2"&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;&amp;quot;&amp;quot;c&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font color="#800000"&gt;...&lt;/font&gt;&lt;/p&gt;&lt;font color="#800000" size="2"&gt;&lt;font color="#800000" size="2"&gt;&lt;font size="2"&gt;strNewCommand = strOldCommand.Replace(&lt;/font&gt;&lt;font color="#800000" size="2"&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;as [CasingModelData]}&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;, _&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;&lt;/font&gt;&lt;font color="#800000" size="2"&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;as [CasingModelData] WHERE CasingName LIKE &amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &amp;amp; Quote &amp;amp; CasingNam &amp;amp; Quote &amp;amp; &lt;/font&gt;&lt;font color="#800000" size="2"&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;}&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;)&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;&lt;/font&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;&amp;nbsp;&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;</description></item><item><title>Re: Wildcard query when a relationship exists between two tables</title><link>https://www.infopathdev.com:443/forums/thread/37666.aspx</link><pubDate>Mon, 26 Jan 2009 16:14:16 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:37666</guid><dc:creator>Jimmy</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/37666.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=37666</wfw:commentRss><description>&lt;p&gt;I know the Microsoft example uses this syntax, but I don&amp;#39;t think it&amp;#39;s correct to use double quotes with a LIKE clause:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp; strMySQLCommand = strMySQLCommand + &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot;([Supplier_T].[strSupplierName] LIKE \&amp;quot;&amp;quot; + strName + &amp;quot;\&amp;quot;)&amp;quot;;&lt;br /&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;What happens if you replace that with this:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp; strMySQLCommand = strMySQLCommand + &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot;([Supplier_T].[strSupplierName] LIKE &lt;font color="red"&gt;&amp;#39;&lt;/font&gt;&amp;quot; + strName + &amp;quot;&lt;font color="red"&gt;&amp;#39;&lt;/font&gt;)&amp;quot;;&lt;br /&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve replaced the double quotes before and after strName with single quotes (shown in red).&lt;/p&gt;</description></item><item><title>Re: Wildcard query when a relationship exists between two tables</title><link>https://www.infopathdev.com:443/forums/thread/37663.aspx</link><pubDate>Mon, 26 Jan 2009 16:03:16 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:37663</guid><dc:creator>gdgonzal</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/37663.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=37663</wfw:commentRss><description>&lt;p&gt;The query method on the Document object failed.&lt;/p&gt;
&lt;p&gt;InfoPath cannot run the specified query.&lt;/p&gt;
&lt;p&gt;[0x80040E14][MSDataShape] Data shape command text contains a syntax error at or near 1066 command. The text&amp;nbsp;near the error is: &amp;quot;[Comments_T]Where([Supplier_T].[strSupplierName]&amp;quot;.&lt;/p&gt;
&lt;p&gt;File: script.js&lt;/p&gt;
&lt;p&gt;Line: 105&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Wildcard query when a relationship exists between two tables</title><link>https://www.infopathdev.com:443/forums/thread/37661.aspx</link><pubDate>Mon, 26 Jan 2009 15:58:51 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:37661</guid><dc:creator>RichardA</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/37661.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=37661</wfw:commentRss><description>&lt;p&gt;Given my level of programming skills,&amp;nbsp;my recommendation would be to add in a number of MessageBox.show statements so you can see the value of the string strMySQLCommand.&amp;nbsp; By doing this, you will be able to see that by appending the where clause at the end of the SQL statement is creating bad syntax.&amp;nbsp;&amp;nbsp; Add in the message boxes, and you can see how the sql statement is being modified with your changes.&amp;nbsp; You may need to use some creative string processing to put the where clause in the right spot&lt;/p&gt;
&lt;p&gt;&amp;nbsp;Rich&lt;/p&gt;</description></item><item><title>Re: Wildcard query when a relationship exists between two tables</title><link>https://www.infopathdev.com:443/forums/thread/37656.aspx</link><pubDate>Mon, 26 Jan 2009 15:26:50 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:37656</guid><dc:creator>Jimmy</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/37656.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=37656</wfw:commentRss><description>&lt;p&gt;What error do you get when you use that code?&lt;/p&gt;</description></item><item><title>Re: Wildcard query when a relationship exists between two tables</title><link>https://www.infopathdev.com:443/forums/thread/37637.aspx</link><pubDate>Mon, 26 Jan 2009 05:02:54 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:37637</guid><dc:creator>gdgonzal</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/37637.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=37637</wfw:commentRss><description>&lt;p&gt;{&lt;br /&gt;&amp;nbsp; // Get the default SQL command for the form.&lt;br /&gt;&amp;nbsp; var strOrigSQLCommand = XDocument.QueryAdapter.Command;&lt;/p&gt;
&lt;p&gt;&amp;nbsp; // Get the query node that you want to modify.&lt;br /&gt;&amp;nbsp; var querySupplier_T = XDocument.DOM.selectSingleNode(&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot;/dfs:myFields/dfs:queryFields/q:Supplier_T&amp;quot;);&lt;br /&gt;&amp;nbsp; var queryRegion_T = XDocument.DOM.selectSingleNode(&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot;/dfs:myFields/dfs:queryFields/q:Region_T&amp;quot;);&lt;br /&gt;&amp;nbsp; var queryRegionStates_T = XDocument.DOM.selectSingleNode(&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot;/dfs:myFields/dfs:queryFields/q:RegionStates_T&amp;quot;);&lt;br /&gt;&amp;nbsp; var queryServices_T = XDocument.DOM.selectSingleNode(&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot;/dfs:myFields/dfs:queryFields/q:Services_T&amp;quot;);&lt;br /&gt;&amp;nbsp; var queryServicesAttributes_T = XDocument.DOM.selectSingleNode(&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot;/dfs:myFields/dfs:queryFields/q:ServicesAttributes_T&amp;quot;);&lt;br /&gt;&amp;nbsp; var queryComments_T = XDocument.DOM.selectSingleNode(&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot;/dfs:myFields/dfs:queryFields/q:Comments_T&amp;quot;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp; // Obtain the text that was entered for the wildcard character search, and then clear&lt;br /&gt;&amp;nbsp; // the current query parameter so that InfoPath will leave the current query parameter blank.&lt;br /&gt;&amp;nbsp; var strName = querySupplier_T.selectSingleNode(&amp;quot;@strSupplierName&amp;quot;).text;&lt;br /&gt;&amp;nbsp; querySupplier_T.selectSingleNode(&amp;quot;@strSupplierName&amp;quot;).text = &amp;quot;&amp;quot;;&lt;br /&gt;&amp;nbsp; &lt;br /&gt;&amp;nbsp; // Ask InfoPath to construct an SQL command that is based on all other field values.&lt;br /&gt;&amp;nbsp; var strMySQLCommand = XDocument.QueryAdapter.BuildSQLFromXMLNodes(querySupplier_T);&lt;/p&gt;
&lt;p&gt;&amp;nbsp; // Save each of the other query items, and then clear the other query items before the next query.&lt;br /&gt;&amp;nbsp; var IngSupplierID = querySupplier_T.selectSingleNode(&amp;quot;@IngSupplierID&amp;quot;).text;&lt;br /&gt;&amp;nbsp; querySupplier_T.selectSingleNode(&amp;quot;@IngSupplierID&amp;quot;).text = &amp;quot;&amp;quot;;&lt;br /&gt;&amp;nbsp; var dtSupplierDate = querySupplier_T.selectSingleNode(&amp;quot;@dtSupplierDate&amp;quot;).text;&lt;br /&gt;&amp;nbsp; querySupplier_T.selectSingleNode(&amp;quot;@dtSupplierDate&amp;quot;).text = &amp;quot;&amp;quot;;&amp;nbsp; &lt;br /&gt;&amp;nbsp; var strSupplierNumber = querySupplier_T.selectSingleNode(&amp;quot;@strSupplierNumber&amp;quot;).text;&lt;br /&gt;&amp;nbsp; querySupplier_T.selectSingleNode(&amp;quot;@strSupplierNumber&amp;quot;).text = &amp;quot;&amp;quot;;&lt;br /&gt;&amp;nbsp; var strSupplierAddress1 = querySupplier_T.selectSingleNode(&amp;quot;@strSupplierAddress1&amp;quot;).text;&lt;br /&gt;&amp;nbsp; querySupplier_T.selectSingleNode(&amp;quot;@strSupplierAddress1&amp;quot;).text = &amp;quot;&amp;quot;;&lt;br /&gt;&amp;nbsp; var strSupplierAddress2 = querySupplier_T.selectSingleNode(&amp;quot;@strSupplierAddress2&amp;quot;).text;&lt;br /&gt;&amp;nbsp; querySupplier_T.selectSingleNode(&amp;quot;@strSupplierAddress2&amp;quot;).text = &amp;quot;&amp;quot;;&lt;br /&gt;&amp;nbsp; var strSupplierCity = querySupplier_T.selectSingleNode(&amp;quot;@strSupplierCity&amp;quot;).text;&lt;br /&gt;&amp;nbsp; querySupplier_T.selectSingleNode(&amp;quot;@strSupplierCity&amp;quot;).text = &amp;quot;&amp;quot;;&lt;br /&gt;&amp;nbsp; var IngPostalCode = querySupplier_T.selectSingleNode(&amp;quot;@IngPostalCode&amp;quot;).text;&lt;br /&gt;&amp;nbsp; querySupplier_T.selectSingleNode(&amp;quot;@IngPostalCode&amp;quot;).text = &amp;quot;&amp;quot;;&lt;br /&gt;&amp;nbsp; var IngStateID = querySupplier_T.selectSingleNode(&amp;quot;@IngStateID&amp;quot;).text;&lt;br /&gt;&amp;nbsp; querySupplier_T.selectSingleNode(&amp;quot;@IngStateID&amp;quot;).text = &amp;quot;&amp;quot;;&lt;br /&gt;&amp;nbsp; var IngCountryID = querySupplier_T.selectSingleNode(&amp;quot;@IngCountryID&amp;quot;).text;&lt;br /&gt;&amp;nbsp; querySupplier_T.selectSingleNode(&amp;quot;@IngCountryID&amp;quot;).text = &amp;quot;&amp;quot;;&lt;br /&gt;&amp;nbsp; var strRegions = queryRegion_T.selectSingleNode(&amp;quot;@strRegions&amp;quot;).text;&lt;br /&gt;&amp;nbsp; queryRegion_T.selectSingleNode(&amp;quot;@strRegions&amp;quot;).text = &amp;quot;&amp;quot;;&lt;br /&gt;&amp;nbsp; var strRegionStates = queryRegionStates_T.selectSingleNode(&amp;quot;@strRegionStates&amp;quot;).text;&lt;br /&gt;&amp;nbsp; queryRegionStates_T.selectSingleNode(&amp;quot;@strRegionStates&amp;quot;).text = &amp;quot;&amp;quot;;&lt;br /&gt;&amp;nbsp; var strServices = queryServices_T.selectSingleNode(&amp;quot;@strServices&amp;quot;).text;&lt;br /&gt;&amp;nbsp; queryServices_T.selectSingleNode(&amp;quot;@strServices&amp;quot;).text = &amp;quot;&amp;quot;;&lt;br /&gt;&amp;nbsp; var strServicesAttributes = queryServicesAttributes_T.selectSingleNode(&amp;quot;@strServicesAttributes&amp;quot;).text;&lt;br /&gt;&amp;nbsp; queryServicesAttributes_T.selectSingleNode(&amp;quot;@strServicesAttributes&amp;quot;).text = &amp;quot;&amp;quot;;&amp;nbsp; &lt;br /&gt;&amp;nbsp; var strCommentEnteredBy = queryComments_T.selectSingleNode(&amp;quot;@strCommentEnteredBy&amp;quot;).text;&lt;br /&gt;&amp;nbsp; queryComments_T.selectSingleNode(&amp;quot;@strCommentEnteredBy&amp;quot;).text = &amp;quot;&amp;quot;;&lt;br /&gt;&amp;nbsp; var dtCommentEnteredDate = queryComments_T.selectSingleNode(&amp;quot;@dtCommentEnteredDate&amp;quot;).text;&lt;br /&gt;&amp;nbsp; queryComments_T.selectSingleNode(&amp;quot;@dtCommentEnteredDate&amp;quot;).text = &amp;quot;&amp;quot;;&lt;br /&gt;&amp;nbsp; var txtComment = queryComments_T.selectSingleNode(&amp;quot;@txtComment&amp;quot;).text;&lt;br /&gt;&amp;nbsp; queryComments_T.selectSingleNode(&amp;quot;@txtComment&amp;quot;).text = &amp;quot;&amp;quot;;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp; //&amp;nbsp; Add strSupplierName to the query so&lt;br /&gt;&amp;nbsp; // that strSupplierName can support wildcard characters.&lt;br /&gt;&amp;nbsp; if (strName != &amp;quot;&amp;quot;)&lt;br /&gt;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (strMySQLCommand != &amp;quot;&amp;quot;)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; strMySQLCommand = strMySQLCommand + &amp;quot; AND &amp;quot;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; strMySQLCommand = strMySQLCommand + &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot;([Supplier_T].[strSupplierName] LIKE \&amp;quot;&amp;quot; + strName + &amp;quot;\&amp;quot;)&amp;quot;;&lt;br /&gt;&amp;nbsp; }&lt;br /&gt;&amp;nbsp; &lt;br /&gt;&amp;nbsp; // Construct the full query string.&lt;br /&gt;&amp;nbsp; var strSQLQuery = strOrigSQLCommand;&lt;br /&gt;&amp;nbsp; if (strMySQLCommand != &amp;quot;&amp;quot;)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; strSQLQuery = strSQLQuery + &amp;quot; WHERE &amp;quot; + strMySQLCommand;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp; // This is the query.&lt;br /&gt;&amp;nbsp; //XDocument.UI.Alert(strSQLQuery);&lt;/p&gt;
&lt;p&gt;&amp;nbsp; // Run the query.&lt;br /&gt;&amp;nbsp; XDocument.QueryAdapter.Command = strSQLQuery;&lt;br /&gt;&amp;nbsp; XDocument.Query();&lt;br /&gt;&amp;nbsp; &lt;br /&gt;&amp;nbsp; // Restore all the user entries to the Query fields so that the user entries will &lt;br /&gt;&amp;nbsp; // be available if you want to modify and to rerun the query.&lt;br /&gt;&amp;nbsp; querySupplier_T.selectSingleNode(&amp;quot;@IngSupplierID&amp;quot;).text = IngSupplierID;&lt;br /&gt;&amp;nbsp; querySupplier_T.selectSingleNode(&amp;quot;@dtSupplierDate&amp;quot;).text = dtSupplierDate;&lt;br /&gt;&amp;nbsp; querySupplier_T.selectSingleNode(&amp;quot;@strSupplierName&amp;quot;).text = strSupplierName;&lt;br /&gt;&amp;nbsp; querySupplier_T.selectSingleNode(&amp;quot;@strSupplierNumber&amp;quot;).text = strSupplierNumber;&lt;br /&gt;&amp;nbsp; querySupplier_T.selectSingleNode(&amp;quot;@strSupplierAddress1&amp;quot;).text = strSupplierAddress1;&lt;br /&gt;&amp;nbsp; querySupplier_T.selectSingleNode(&amp;quot;@strSupplierAddress2&amp;quot;).text = strSupplierAddress2;&lt;br /&gt;&amp;nbsp; querySupplier_T.selectSingleNode(&amp;quot;@strSupplierCity&amp;quot;).text = strSupplierCity;&lt;br /&gt;&amp;nbsp; querySupplier_T.selectSingleNode(&amp;quot;@IngPostalCode&amp;quot;).text = IngPostalCode;&lt;br /&gt;&amp;nbsp; querySupplier_T.selectSingleNode(&amp;quot;@IngStateID&amp;quot;).text = IngStateID;&lt;br /&gt;&amp;nbsp; querySupplier_T.selectSingleNode(&amp;quot;@IngCountryID&amp;quot;).text = IngCountryID;&lt;br /&gt;&amp;nbsp; queryRegions_T.selectSingleNode(&amp;quot;@strRegions&amp;quot;).text = strRegions;&lt;br /&gt;&amp;nbsp; queryRegionStates_T.selectSingleNode(&amp;quot;@strRegionStates&amp;quot;).text = strRegionStates;&lt;br /&gt;&amp;nbsp; queryServices_T.selectSingleNode(&amp;quot;@strServices&amp;quot;).text = strServices;&lt;br /&gt;&amp;nbsp; queryServicesAttributes_T.selectSingleNode(&amp;quot;@strServicesAttributes&amp;quot;).text = strServicesAttributes;&lt;br /&gt;&amp;nbsp; queryComments_T.selectSingleNode(&amp;quot;@strCommentEnteredBy&amp;quot;).text = strCommentEnteredBy;&lt;br /&gt;&amp;nbsp; queryComments_T.selectSingleNode(&amp;quot;@dtCommentEnteredDate&amp;quot;).text = dtCommentEnteredDate;&lt;br /&gt;&amp;nbsp; queryComments_T.selectSingleNode(&amp;quot;@txtComment&amp;quot;).text = txtComment;&lt;br /&gt;&amp;nbsp; &lt;br /&gt;&amp;nbsp; // Restore the default table command (for the next time).&lt;br /&gt;&amp;nbsp; XDocument.QueryAdapter.Command = strOrigSQLCommand;&lt;br /&gt;&amp;nbsp; &lt;br /&gt;&amp;nbsp; // Switch to data entry view to see results.&lt;br /&gt;&amp;nbsp; XDocument.View.SwitchView(&amp;quot;Advanced Reporting&amp;quot;);&lt;br /&gt;&amp;nbsp; &lt;br /&gt;}&lt;/p&gt;</description></item><item><title>Re: Wildcard query when a relationship exists between two tables</title><link>https://www.infopathdev.com:443/forums/thread/37636.aspx</link><pubDate>Mon, 26 Jan 2009 02:09:51 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:37636</guid><dc:creator>Jimmy</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/37636.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=37636</wfw:commentRss><description>&lt;p&gt;By &lt;u&gt;it&lt;/u&gt;&lt;em&gt;,&lt;/em&gt; RichardA is referring to InfoPath.&amp;nbsp; And you wouldn&amp;#39;t necessarily have strNewCommand in your code.&amp;nbsp; That is simply a variable name that RichardA is using and is entirely arbitrary.&amp;nbsp; Perhaps you could post your code and we could try to figure out why it isn&amp;#39;t working?&lt;/p&gt;</description></item><item><title>Re: Wildcard query when a relationship exists between two tables</title><link>https://www.infopathdev.com:443/forums/thread/37628.aspx</link><pubDate>Sun, 25 Jan 2009 07:32:13 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:37628</guid><dc:creator>gdgonzal</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/37628.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=37628</wfw:commentRss><description>&lt;p&gt;You say , &amp;quot;in the one I was using, &lt;u&gt;&lt;strong&gt;it&lt;/strong&gt;&lt;/u&gt; added &amp;quot;relate [ID] to [System]&amp;quot; after the select command for the second table&amp;quot;, I&amp;#39;m not following...when you say &amp;quot;it&amp;quot; what exactly are you referring to?&amp;nbsp; Could you just post the amended code in its entirety so I can see what it is you mean?&amp;nbsp; I&amp;#39;m going through my own code and I don&amp;#39;t see where there&amp;#39;s any reference to strNewCommand.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;Thanks&lt;/p&gt;</description></item><item><title>Re: Wildcard query when a relationship exists between two tables</title><link>https://www.infopathdev.com:443/forums/thread/36941.aspx</link><pubDate>Mon, 12 Jan 2009 16:27:40 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:36941</guid><dc:creator>RichardA</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/36941.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=36941</wfw:commentRss><description>&lt;p&gt;I ran into the same issue. The problem is that InfoPath adds to the ADO connection query to relate the tables.&amp;nbsp; For example, in the one I was using, it added &amp;quot;relate [ID] to [System]&amp;quot; after the select command for the second table.&amp;nbsp; If you just append the wildcard query to the ADO connection command, you&amp;#39;ll get the complaint about the bad syntax.&amp;nbsp; What I did to work around this was to replace the &amp;quot;from [table_name]&amp;quot; part of the query with &amp;quot;from [table_name] where [field] LIKE &amp;quot;wildcardvalue&amp;quot;.&amp;nbsp; In VB, this looked like this:&lt;/p&gt;&lt;font size="2"&gt;strNewCommand = strOldCommand.Replace(&lt;/font&gt;&lt;font color="#800000" size="2"&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;from [Table2]}&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;, _&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;&lt;/font&gt;&lt;font color="#800000" size="2"&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;from [Table2] WHERE&amp;nbsp;Field2 LIKE &amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &amp;amp; Quote &amp;amp; strSearchCriteria &amp;amp; Quote &amp;amp; &lt;/font&gt;&lt;font color="#800000" size="2"&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;}&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;)&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;&amp;nbsp;It then worked as long as I used the % as the wildcard character.&lt;/font&gt;&lt;font size="2"&gt;&lt;/p&gt;&lt;/font&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Wildcard query when a relationship exists between two tables</title><link>https://www.infopathdev.com:443/forums/thread/29058.aspx</link><pubDate>Fri, 30 May 2008 08:39:17 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:29058</guid><dc:creator>Larry</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/29058.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=29058</wfw:commentRss><description>&lt;p&gt;Hi,&amp;nbsp; I am having the exact same issue.&amp;nbsp; Can anyone suggest whether it can be done?&lt;/p&gt;
&lt;p&gt;Many thanks,&lt;/p&gt;
&lt;p&gt;Larry&lt;/p&gt;</description></item></channel></rss>