<?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: Custom Queries for data connections</title><link>https://www.infopathdev.com:443/forums/thread/9129.aspx</link><pubDate>Wed, 22 Feb 2006 02:07:41 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:9129</guid><dc:creator>delu</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/9129.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=9129</wfw:commentRss><description>It works fine :)&lt;br /&gt;Thanks a lot!!</description></item><item><title>Re: Custom Queries for data connections</title><link>https://www.infopathdev.com:443/forums/thread/9128.aspx</link><pubDate>Tue, 21 Feb 2006 20:01:49 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:9128</guid><dc:creator>Agni Jonnalagadda</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/9128.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=9128</wfw:commentRss><description>Hi,&lt;br /&gt;Try the following queries they might help you out&lt;br /&gt;&lt;br /&gt;Dataconnection query&lt;br /&gt;SELECT DISTINCT&lt;br /&gt;CASE isActive&lt;br /&gt;when 1 then 'yes'&lt;br /&gt;when 0 then 'no'&lt;br /&gt;else 'unknown'&lt;br /&gt;end AS isActive&lt;br /&gt;FROM [dbo].[Members] as Members&lt;br /&gt;&lt;br /&gt;and your code query should look like&lt;br /&gt;    "SELECT DISTINCT " +&lt;br /&gt;    " CASE " + column + &lt;br /&gt;    " WHEN 0 THEN '" + c0 + "'" +&lt;br /&gt;    " WHEN 1 THEN '" + c1 + "'" +&lt;br /&gt;    " ELSE 'unknown'" +&lt;br /&gt;    " END AS isActive" +&lt;br /&gt;    " FROM " + table + "as Members ORDER BY " + column;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Agni&lt;br /&gt;INFOPATHdev India</description></item><item><title>Custom Queries for data connections</title><link>https://www.infopathdev.com:443/forums/thread/5380.aspx</link><pubDate>Tue, 21 Feb 2006 07:10:36 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:5380</guid><dc:creator>delu</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/5380.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=5380</wfw:commentRss><description>I made a data connection with a custom query, that looks like this:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;SELECT DISTINCT&lt;br /&gt;CASE isActive&lt;br /&gt;when 1 then 'yes'&lt;br /&gt;when 0 then 'no'&lt;br /&gt;else 'unknown'&lt;br /&gt;end AS isActive&lt;br /&gt;FROM [dbo].[Members]&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;I bound this data connection to a list box and it works fine. &lt;br /&gt;I call this data connection from manage code:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;thisXDocument.DataObjects[secondary].Query();&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;and it still works fine.&lt;br /&gt;&lt;br /&gt;But when I change the query with manged code, I get &lt;u&gt;no&lt;/u&gt;&lt;br /&gt;return set:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;ADOAdapter oSecondary;&lt;br /&gt;oSecondary =  ADOAdapter)thisXDocument.DataObjects[secondary].QueryAdapter;&lt;br /&gt;oSecondary.Command = "SELECT DISTINCT " +&lt;br /&gt;    " CASE " + column +&lt;br /&gt;    " WHEN 0 THEN '" + c0 + "'" +&lt;br /&gt;    " WHEN 1 THEN '" + c1 + "'" +&lt;br /&gt;    " ELSE 'unknown'" +&lt;br /&gt;    " END AS " + column +&lt;br /&gt;    " FROM " + table + " ORDER BY " + column;&lt;br /&gt;thisXDocument.DataObjects[secondary].Query();&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Can anybody help me?&lt;br /&gt;&lt;br /&gt;Thanks in advance!&lt;br /&gt;&lt;br /&gt;</description></item></channel></rss>