<?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</title><link>https://www.infopathdev.com:443/forums/thread/3652.aspx</link><pubDate>Thu, 14 Dec 2006 18:40:15 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:3652</guid><dc:creator>jkies00</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/3652.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=3652</wfw:commentRss><description>I'm not sure what the SQL manager query window is, but I ran it through Access, and it worked.  Is SQL manager query window a utility in InfoPath?  If so, where do I find it?  The SQL syntax was part of the problem, as it turns out...&lt;br /&gt;&lt;br /&gt;The SQL syntax, while it works in Access, didn't work in InfoPath.  I had to change the * wildcard indicators to %.&lt;br /&gt;&lt;br /&gt;From:&lt;br /&gt;&lt;pre&gt;select [ID],[Name] from [tDisc] as [tDisc] WHERE tDisc.Name LIKE "*acro*"&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;To:&lt;br /&gt;&lt;pre&gt;select [ID],[Name] from [tDisc] as [tDisc] WHERE tDisc.Name LIKE "%acro%"&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;I figured this out by reading the KnowledgeBase article above.  It said to enter "Sales%" into their example form to enable wildcard searching.  I just built the % character into the code, so whatever the user enters will be prepended and appended with %.&lt;br /&gt;&lt;br /&gt;The second part of the problem was that I needed to use the ADOAdapter  object to enable InfoPath to use more complex SQL actions.  Excerpt from the KB article: "...By using the ADOAdapter object, you can modify an SQL statement to perform more complex actions such as using wildcard characters in a query..."&lt;br /&gt;&lt;br /&gt;Here's the function I use to perform wildcard queries on the DB, based on the code in the KB article:&lt;br /&gt;&lt;pre&gt;function CTRL2_8::OnClick(eventObj)&lt;br /&gt;{	&lt;br /&gt;	// Get the default SQL command for the form &amp; instantiate variable for new SQL code.&lt;br /&gt;	var strOrigSQLCommand = XDocument.QueryAdapter.Command;&lt;br /&gt;	var strNewSQLCommand = strOrigSQLCommand;&lt;br /&gt;	    &lt;br /&gt;	// Get the query node that you want to modify.    &lt;br /&gt;	var querySuppliers = XDocument.DOM.selectSingleNode("/dfs:myFields/dfs:queryFields/q:tDisc");&lt;br /&gt;    &lt;br /&gt;	// Obtain the text that was entered for the wildcard character search, and then clear&lt;br /&gt;	// the current query parameter so that InfoPath will leave the current query parameter blank.&lt;br /&gt;	var strTitle = XDocument.DOM.selectSingleNode("/dfs:myFields/dfs:queryFields/q:tDisc/@Name").text;&lt;br /&gt;	querySuppliers.selectSingleNode("@Name").text = "";&lt;br /&gt;		&lt;br /&gt;	if (strTitle != "")&lt;br /&gt;	{&lt;br /&gt;	    strNewSQLCommand +=	" WHERE [tDisc].[Name] LIKE \"%" + strTitle + "%\"";&lt;br /&gt;	}&lt;br /&gt;	  &lt;br /&gt;	// This is the query.&lt;br /&gt;	XDocument.UI.Alert(strNewSQLCommand);&lt;br /&gt;&lt;br /&gt;	// Run the query.&lt;br /&gt;	XDocument.QueryAdapter.Command = strNewSQLCommand;&lt;br /&gt;	XDocument.Query();&lt;br /&gt;		  &lt;br /&gt;	// Restore the default table command (for the next time).&lt;br /&gt;	XDocument.QueryAdapter.Command = strOrigSQLCommand;	&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;I'd like to refactor the code above, specifically the part dealing with XPath, but every attempt I've made breaks the form.  I hope someone find this code helpful, and if anyone can succesfully refactor the XPath bit, I'm all ears!&lt;br /&gt;&lt;br /&gt;Thanks!</description></item><item><title>Re: Wildcard Query</title><link>https://www.infopathdev.com:443/forums/thread/3651.aspx</link><pubDate>Thu, 14 Dec 2006 17:18:50 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:3651</guid><dc:creator>Greg Collins</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/3651.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=3651</wfw:commentRss><description>Did you verify that this command works from the SQL manager query window? If it doesn't, then its likely an issue with the command syntax. If it does, then perhaps the Command property isn't getting set somehow.</description></item><item><title>Wildcard Query</title><link>https://www.infopathdev.com:443/forums/thread/1726.aspx</link><pubDate>Tue, 12 Dec 2006 19:59:29 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:1726</guid><dc:creator>jkies00</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/1726.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=1726</wfw:commentRss><description>Hello,&lt;br /&gt;&lt;br /&gt;I'm trying to perform a simple wildcard query through InfoPath.  The query works when I run it in Access, but it doesn't do anything when I run it through InfoPath.  The query is below:&lt;br /&gt;&lt;pre&gt;select [ID],[Name] from [tDisc] as [tDisc] WHERE tDisc.Name LIKE "*acro*"&lt;/pre&gt;&lt;br /&gt;I got the syntax for the wildcard from a Microsoft Knowledge Base article:&lt;br /&gt;&lt;a href='http://support.microsoft.com/default.aspx?kbid=826992&amp;product=infopath2003' target='_blank' title='http://support.microsoft.com/default.aspx?kbid=826992&amp;product=infopath2003'&lt;a target="_blank" href=http://support.microsoft.com/default.aspx?kbid=826992&amp;product=infopath2003&gt;http://support.microsoft.com/default.aspx?kbid=826992&amp;product=infopath2003&lt;/a&gt;&lt;/a&gt;&lt;br /&gt;But it still won't work.  When I click the button to run my custom code, it returns no information - no records, no notification that no data was returned, or no error.  Here's the code I use to generate the SQL:&lt;br /&gt;&lt;pre&gt;function CTRL2_8::OnClick(eventObj)&lt;br /&gt;{&lt;br /&gt;	var origSQLCommand = XDocument.DataAdapters["Main connection"].Command;&lt;br /&gt;	var queryInputString = XDocument.DOM.selectSingleNode("//dfs:queryFields/q:tDisc/@Name").text;&lt;br /&gt;	var newSQLCommand = origSQLCommand;&lt;br /&gt;	newSQLCommand += " WHERE tDisc.Name LIKE \"*" + queryInputString + "*\"";&lt;br /&gt;	XDocument.UI.Alert(newSQLCommand);&lt;br /&gt;	XDocument.DataAdapters["Main connection"].Command = newSQLCommand;&lt;br /&gt;	XDocument.DataAdapters["Main connection"].Query();&lt;br /&gt;	XDocument.DataAdapters["Main connection"].Command = origSQLCommand;	&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;How can I debug if I'm not getting any information back?  Is there a certain way wildcards need to be used in InfoPath that I'm not aware of?</description></item></channel></rss>