<?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: SQL returns value</title><link>https://www.infopathdev.com:443/forums/thread/17289.aspx</link><pubDate>Sun, 11 Jun 2006 03:07:04 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:17289</guid><dc:creator>Matt Faus</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/17289.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=47&amp;PostID=17289</wfw:commentRss><description>Actually, if your form's main DOM is the database connection, you can issue queries against it through the "queryFields" group.&lt;br /&gt;&lt;br /&gt;However, when trying to make a secondary data connection to a DB you can't accomplish this in the IP designer, but you can through the use of code.  Just add a regular database connection, and then write a little code that does something like this:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;// Grab the field from the form&lt;br /&gt;string sCurrentId = getNodeValue("/my:Timecard/my:Common/my:ResourceId");&lt;br /&gt;&lt;br /&gt;// Construct the query&lt;br /&gt;ADOAdapter dbConn = (ADOAdapter)thisXDocument.DataObjects["Project-WorkItems"].QueryAdapter;&lt;br /&gt;dbConn.Command = ConstructResourceQueryString(sCurrentId);            &lt;br /&gt;thisXDocument.DataObjects["Project-WorkItems"].Query();&lt;br /&gt;&lt;br /&gt;private string ConstructResourceQueryString(string sResourceId)&lt;br /&gt;{&lt;br /&gt;    sResourceId = ConvertIPGuid(sResourceId);&lt;br /&gt;&lt;br /&gt;    string[] lines = new string[11];&lt;br /&gt;    lines[0] = "shape ";&lt;br /&gt;    lines[1] = "{select \"ProjectID\",\"Name\",\"Code\",\"StartDate\",\"CustomerID\",\"RateOverhead\",\"Billable\" from \"dbo\".\"Project\" as \"Project\"} as \"Project\"";&lt;br /&gt;    lines[2] = "append";&lt;br /&gt;    lines[3] = "({select \"WorkItemID\",\"Description\",\"Hours\",\"Rate\",\"ResourceID\",\"Completed\",\"MilestoneID\",\"ProjectID\",\"StartDate\" from \"dbo\".\"WorkItem1\" as \"WorkItem1\" }";&lt;br /&gt;    lines[4] = "relate \"ProjectID\" TO \"ProjectID\") as \"WorkItem1\", ";&lt;br /&gt;    lines[5] = "({select \"WorkItemID\",\"Description\",\"Hours\",\"Rate\",\"ResourceID\",\"Completed\",\"MilestoneID\",\"ProjectID\",\"StartDate\" from \"dbo\".\"WorkItem2\" as \"WorkItem2\" where \"ResourceID\" = '" + sResourceId + "'}";&lt;br /&gt;    lines[6] = "relate \"ProjectID\" TO \"ProjectID\") as \"WorkItem2\", ";&lt;br /&gt;    lines[7] = "({select \"WorkItemID\",\"Description\",\"Hours\",\"Rate\",\"ResourceID\",\"Completed\",\"MilestoneID\",\"ProjectID\" from \"dbo\".\"WorkItem3\" as \"WorkItem3\" where \"ResourceID\" = '" + sResourceId + "'}";&lt;br /&gt;    lines[8] = "relate \"ProjectID\" TO \"ProjectID\") as \"WorkItem3\", ";&lt;br /&gt;    lines[9] = "({select \"WorkItemID\",\"Description\",\"Hours\",\"Rate\",\"ResourceID\",\"Completed\",\"MilestoneID\",\"ProjectID\" from \"dbo\".\"WorkItem4\" as \"WorkItem4\" where \"ResourceID\" = '" + sResourceId + "'}";&lt;br /&gt;    lines[10] = "relate \"ProjectID\" TO \"ProjectID\") as \"WorkItem4\"";&lt;br /&gt;&lt;br /&gt;    string query = String.Format("{0} {1} {2} {3} {4} {5} {6} {7} {8} {9} {10} ",&lt;br /&gt;                        lines[0],&lt;br /&gt;                        lines[1],&lt;br /&gt;                        lines[2],&lt;br /&gt;                        lines[3],&lt;br /&gt;                        lines[4],&lt;br /&gt;                        lines[5],&lt;br /&gt;                        lines[6],&lt;br /&gt;                        lines[7],&lt;br /&gt;                        lines[8],&lt;br /&gt;                        lines[9],&lt;br /&gt;                        lines[10]);&lt;br /&gt;&lt;br /&gt;    return query;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;This example uses C#.NET, but should be able to convert to any other language that IP supports. I hope this helps!</description></item><item><title>Re: SQL returns value</title><link>https://www.infopathdev.com:443/forums/thread/17288.aspx</link><pubDate>Sat, 10 Jun 2006 08:24:59 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:17288</guid><dc:creator>Patrick Halstead</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/17288.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=47&amp;PostID=17288</wfw:commentRss><description>Hi Zar-man and welcome to our forum!&lt;br /&gt;InfoPath doesn't support data field based queries using the built-in SQL data connection query string. Check out our Database Accelerator or write your own web service.</description></item><item><title>SQL returns value</title><link>https://www.infopathdev.com:443/forums/thread/16813.aspx</link><pubDate>Tue, 06 Jun 2006 16:32:30 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:16813</guid><dc:creator>Zar-man</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/16813.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=47&amp;PostID=16813</wfw:commentRss><description>I designed a form and opened it in VS2005.  I added a secondary data connection(SQL 2003).&lt;br /&gt;&lt;br /&gt;What I'm trying to do is this,  when a person fills out this form they enter their SSN and then when they cliick a button, I want it to return their values like name, address, sex, ect.  All those I have in a SQL table called social.  Which I added as my secondary data source.&lt;br /&gt;&lt;br /&gt;I'm new to coding and Infopath, so how would I go about doing this.  Right now nothing happens, Is there alot of code writing to be able to do this?</description></item></channel></rss>