<?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>SQL Database Integration</title><link>https://www.infopathdev.com:443/forums/47.aspx</link><description>For questions concerning issues in the integration of SQL and Microsoft InfoPath.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: Filtering Secondary Data Source</title><link>https://www.infopathdev.com:443/forums/thread/17196.aspx</link><pubDate>Thu, 26 Jan 2006 12:16:07 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:17196</guid><dc:creator>vapires</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/17196.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=47&amp;PostID=17196</wfw:commentRss><description>Hello Matt,&lt;br /&gt;&lt;br /&gt;Thanks for your help.  &lt;br /&gt;&lt;br /&gt;I am able to now selectSingleNode into my query. I am using c#. &lt;br /&gt;The problem I am having is that when I try to use the QueryAdapter I do not see the command attribute. &lt;br /&gt;ie I do not see oSecondary.QueryAdapter.Command &lt;br /&gt;I can just get to oSecondary.QueryAdapter  therefore I cannot build my query. Is there something I'm missing to do?&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;As a work around I have tried doing the following, but this does not work either. Any help is appreciated. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;string sNodeText = thisXDocument.DOM.selectSingleNode("//dfs:myFields//dfs:dataFields/d:PPProject/d:PPAssoc/@ContactID").text;&lt;br /&gt;&lt;br /&gt;		&lt;br /&gt;			//Define SQl Connection			&lt;br /&gt;			SqlConnection ADConnection = new SqlConnection();&lt;br /&gt;			ADConnection.ConnectionString = "password=mycity;user id=mycity;data source=sql02;persist security info=False;initial catalog=CustomApps";&lt;br /&gt;			SqlCommand ADCommand = new SqlCommand();&lt;br /&gt;			ADCommand.Connection = ADConnection;&lt;br /&gt;			ADCommand.CommandText = "select * from PPEmployee(nolock) where contactid=" + sNodeText;&lt;br /&gt;			ADCommand.CommandType = CommandType.Text;&lt;br /&gt;			DataSet ADData = new DataSet();&lt;br /&gt;			SqlDataAdapter ADAdapter = new SqlDataAdapter();&lt;br /&gt;			ADAdapter.SelectCommand = ADCommand;&lt;br /&gt;			ADConnection.Open();&lt;br /&gt;			ADAdapter.Fill(ADData, "AD");&lt;br /&gt;			ADConnection.Close();&lt;br /&gt;&lt;br /&gt;There are only 10 types of people in the world - Those who understand binary, and those who don't.</description></item><item><title>Re: Filtering Secondary Data Source</title><link>https://www.infopathdev.com:443/forums/thread/17195.aspx</link><pubDate>Wed, 25 Jan 2006 14:46:33 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:17195</guid><dc:creator>Matt Faus</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/17195.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=47&amp;PostID=17195</wfw:commentRss><description>Well, you could just grab it in your code, like this:&lt;br /&gt;&lt;br /&gt;var sNodeText = XDocument.DOM.selectSingleNode( "/my:myFields/my:IdField" ).text;&lt;br /&gt;&lt;br /&gt;Then, construct the query string with the variable:&lt;br /&gt;&lt;br /&gt;oSecondary.QueryAdapter.Command = "SELECT * FROM customTable WHERE id &amp;gt; " + sNodeText;&lt;br /&gt;&lt;br /&gt;Be sure to substitute appropriate XPath for your form.&lt;br /&gt;&lt;br /&gt;---------------&lt;br /&gt;Matt Faus&lt;br /&gt;InfoPath Dev Texas&lt;br /&gt;</description></item><item><title>Re: Filtering Secondary Data Source</title><link>https://www.infopathdev.com:443/forums/thread/17194.aspx</link><pubDate>Wed, 25 Jan 2006 12:05:43 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:17194</guid><dc:creator>vapires</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/17194.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=47&amp;PostID=17194</wfw:commentRss><description>Hello Matt,&lt;br /&gt;&lt;br /&gt;One more question. If I choose to do it by custom SQL commands, how would I get the text box node value in the where clause? &lt;br /&gt;Appreciate your help, &lt;br /&gt;Vidette &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;// Another way to do it use custom SQL commands&lt;br /&gt;oSecondary.QueryAdapter.Command = "SELECT * FROM customTable WHERE id &amp;gt; 12";&lt;br /&gt;oSecondary.Query();&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;There are only 10 types of people in the world - Those who understand binary, and those who don't.</description></item><item><title>Re: Filtering Secondary Data Source</title><link>https://www.infopathdev.com:443/forums/thread/17193.aspx</link><pubDate>Tue, 24 Jan 2006 22:11:57 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:17193</guid><dc:creator>deborahh</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/17193.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=47&amp;PostID=17193</wfw:commentRss><description>Thanks, we are going in the direction you have pointed us. We're going to give a try and hopefully get it to work.</description></item><item><title>Re: Filtering Secondary Data Source</title><link>https://www.infopathdev.com:443/forums/thread/17192.aspx</link><pubDate>Tue, 24 Jan 2006 18:58:58 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:17192</guid><dc:creator>Matt Faus</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/17192.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=47&amp;PostID=17192</wfw:commentRss><description>I'm sorry, I forgot that the Query was done on the main data connection.  Check out the following code for some better info:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;var oSecondary = XDocument.DataObjects( "Name of Secondary Data source" );&lt;br /&gt;&lt;br /&gt;// One way to do it - set the query fields correctly then run query&lt;br /&gt;oSecondary.DOM.selectSingleNode( "....." );&lt;br /&gt;oSecondary.Query();&lt;br /&gt;&lt;br /&gt;// Another way to do it use custom SQL commands&lt;br /&gt;oSecondary.QueryAdapter.Command = "SELECT * FROM customTable WHERE id &amp;gt; 12";&lt;br /&gt;oSecondary.Query();&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;---------------&lt;br /&gt;Matt Faus&lt;br /&gt;InfoPath Dev Texas&lt;br /&gt;</description></item><item><title>Re: Filtering Secondary Data Source</title><link>https://www.infopathdev.com:443/forums/thread/17191.aspx</link><pubDate>Tue, 24 Jan 2006 15:56:26 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:17191</guid><dc:creator>deborahh</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/17191.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=47&amp;PostID=17191</wfw:commentRss><description>Thanks for your response Matt. I looked over your HowTo and I see how it could work if you have a table that is in the main connection. However, what do you do if the table you're working on isn't a main data source?&lt;br /&gt;&lt;br /&gt;Example:&lt;br /&gt;&lt;br /&gt;Main Connection: &lt;br /&gt;Projects (ProjectID, ProjName); ProjectID is 1 to many to ProjectID in PContacts&lt;br /&gt;PContacts(PCID, CustomerID, ProjectID)&lt;br /&gt;&lt;br /&gt;Secondary Data Source:&lt;br /&gt;Contacts (ContactID, ContactName)&lt;br /&gt;&lt;br /&gt;I want to use the SDS connection for Contacts to show all ContactID = filter PContacts.ContactID where ProjectID is equal to the current selected project in the form.&lt;br /&gt;&lt;br /&gt;Thanks for your quick response.</description></item><item><title>Re: Filtering Secondary Data Source</title><link>https://www.infopathdev.com:443/forums/thread/17190.aspx</link><pubDate>Tue, 24 Jan 2006 15:27:26 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:17190</guid><dc:creator>Matt Faus</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/17190.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=47&amp;PostID=17190</wfw:commentRss><description>Hello Deborah and welcome to the Forum!&lt;br /&gt;&lt;br /&gt;I have recently written a HowTo that addresses this issue. The HowTo describes creating a master/detail view with a database, but I think the code behind filtering the detail view should still apply to you. Check it out:&lt;br /&gt;&lt;br /&lt;a target="_blank" href=http://infopathdev.com/howto/tutorials/default.aspx?i=0bb37b4de44348408680a53a449f2353&gt;http://infopathdev.com/howto/tutorials/default.aspx?i=0bb37b4de44348408680a53a449f2353&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I hope this helps, let us know if you have any more questiosn!&lt;br /&gt;&lt;br /&gt;---------------&lt;br /&gt;Matt Faus&lt;br /&gt;InfoPath Dev Texas&lt;br /&gt;</description></item><item><title>Filtering Secondary Data Source</title><link>https://www.infopathdev.com:443/forums/thread/16777.aspx</link><pubDate>Tue, 24 Jan 2006 15:16:36 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:16777</guid><dc:creator>deborahh</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/16777.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=47&amp;PostID=16777</wfw:commentRss><description>I've been looking around to see if there is a way to filter data from a secondary data source and am at a loss. This particular table is SQL. &lt;br /&gt;&lt;br /&gt;Once I drag the SDS table onto the form, the option to filter (as you would from a main data connection) isn't there. I want to be able to see all items for the section that fit a particular criteria in the form. I know that filtering for the SDS repeating section through Properties is not available. &lt;br /&gt;&lt;br /&gt;Is there an easy way to create a filter for the SDS?&lt;br /&gt;&lt;br /&gt;Thanks in advance for any help you can provide.</description></item></channel></rss>