<?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: How to Interate Forms with SQL</title><link>https://www.infopathdev.com:443/forums/thread/17202.aspx</link><pubDate>Fri, 27 Jan 2006 18:28:49 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:17202</guid><dc:creator>Patrick Halstead</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/17202.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=47&amp;PostID=17202</wfw:commentRss><description>Hi again Carlos,&lt;br /&gt;You can do this kind of query without code if you install our Database Accelerator product (which is a Web service running on a SQL database). Check out the Downloads section. We have a free evaluation version of Database Accelerator and you can do this kind of query using XPath indexing (as opposed to code).&lt;br /&gt;&lt;br /&gt;Patrick Halstead [InfoPath MVP]&lt;br /&gt;InfoPathDev</description></item><item><title>Re: How to Interate Forms with SQL</title><link>https://www.infopathdev.com:443/forums/thread/17201.aspx</link><pubDate>Fri, 27 Jan 2006 15:34:59 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:17201</guid><dc:creator>Carlos.Carrillo</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/17201.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=47&amp;PostID=17201</wfw:commentRss><description>Hello, thanks Patrick and Agni, I dind't suppose that programming was neccesary, I'm a newbie in infopath (also in programming) and I thought this funcionality was possible in another way.&lt;br /&gt;&lt;br /&gt;I will try with my colleagues here, maybe they can arrange this,&lt;br /&gt;&lt;br /&gt;Anyway thanks very much and the best regards,&lt;br /&gt;Carlos.</description></item><item><title>Re: How to Interate Forms with SQL</title><link>https://www.infopathdev.com:443/forums/thread/17200.aspx</link><pubDate>Fri, 27 Jan 2006 10:26:44 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:17200</guid><dc:creator>Agni Jonnalagadda</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/17200.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=47&amp;PostID=17200</wfw:commentRss><description>Hi Carlos,&lt;br /&gt;Welcome to the Forum!&lt;br /&gt;You can have fields in the UI to take input for 'Updated_By' and Dates, and use these value in the query. Here is the way to do it once you have the input value in the fields.&lt;br /&gt;&lt;br /&gt;string updatedBy = "abc"; //Get Value from the UI field&lt;br /&gt;string date1 = "2006-01-23"; //Get Value from the UI field&lt;br /&gt;string date2 = "2006-01-23"; //Get Value from the UI field&lt;br /&gt;&lt;br /&gt;//Take sql query in a string&lt;br /&gt;string sqlCommand = "SELECT DISTINCT t.Ticket"&lt;br /&gt;+",t.Updated_By AS Ticket_Updated_By"&lt;br /&gt;+",a.Updated_By AS Activity_Updated_By"&lt;br /&gt;+",t.Summary"&lt;br /&gt;+",t.Status"&lt;br /&gt;+",count(*) as Num_Activities "&lt;br /&gt;+"FROM HD_Tickets t"&lt;br /&gt;+"JOIN HD_Ticket_Activity a"&lt;br /&gt;+"on t.ID = a.Ticket_ID"&lt;br /&gt;+"WHERE a.ID IN (SELECT a.ID "&lt;br /&gt;+"FROM HD_Ticket_Activity a"&lt;br /&gt;+"WHERE a.Ticket_ID = t.ID"&lt;br /&gt;+"AND a.Updated_By IN (&lt;b&gt;&lt;font color="red"&gt;'{0}'&lt;/font id="red"&gt;&lt;/b&gt;)"&lt;br /&gt;+"-- AND cast(floor(cast(a.Submit_Date as float)) as datetime) "&lt;br /&gt;+" BETWEEN CONVERT(datetime,&lt;b&gt;&lt;font color="red"&gt;'{1}'&lt;/font id="red"&gt;&lt;/b&gt;,120) "&lt;br /&gt;+" AND CONVERT(datetime,'&lt;b&gt;&lt;font color="red"&gt;{2}&lt;/font id="red"&gt;&lt;/b&gt;',120)"&lt;br /&gt;+")"&lt;br /&gt;+"GROUP BY t.Ticket"&lt;br /&gt;+",t.Updated_By"&lt;br /&gt;+",t.Summary "&lt;br /&gt;+",a.Updated_By "&lt;br /&gt;+",t.Status";&lt;br /&gt;//Add user inputs to you query string&lt;br /&gt;sqlCommand = string.Format(sqlCommand, updatedBy, date1, date2);&lt;br /&gt;//Get SQL dataconnection adapter here&lt;br /&gt;ADOAdapter2 dbConnection = (ADOAdapter2)thisXDocument.DataAdapters["DBConnectioName"];&lt;br /&gt;//Assign you new sql query to the connection adapter&lt;br /&gt;dbConnection.Command = sqlCommand;&lt;br /&gt;//Query the dataconnection&lt;br /&gt;dbConnection.Query();&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Agni&lt;br /&gt;InfoPath Dev India</description></item><item><title>Re: How to Interate Forms with SQL</title><link>https://www.infopathdev.com:443/forums/thread/17199.aspx</link><pubDate>Fri, 27 Jan 2006 08:21:34 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:17199</guid><dc:creator>Patrick Halstead</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/17199.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=47&amp;PostID=17199</wfw:commentRss><description>Hi Carlos,&lt;br /&gt;I think you will need to write code to do this. I'll ask Agni to respond.&lt;br /&gt;&lt;br /&gt;Patrick Halstead [InfoPath MVP]&lt;br /&gt;InfoPathDev</description></item><item><title>How to Interate Forms with SQL</title><link>https://www.infopathdev.com:443/forums/thread/16779.aspx</link><pubDate>Thu, 26 Jan 2006 07:21:16 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:16779</guid><dc:creator>Carlos.Carrillo</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/16779.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=47&amp;PostID=16779</wfw:commentRss><description>Hello everybody,&lt;br /&gt;&lt;br /&gt;I have made a form (new from Data Connection)with a data connection SQL database. I have created a data source without any table, and an SQL statement, the following:&lt;br /&gt;&lt;br /&gt;SELECT DISTINCT t.Ticket&lt;br /&gt;               ,t.Updated_By AS Ticket_Updated_By&lt;br /&gt;               ,a.Updated_By AS Activity_Updated_By&lt;br /&gt;               ,t.Summary&lt;br /&gt;               ,t.Status&lt;br /&gt;               ,count(*) as Num_Activities            &lt;br /&gt;FROM HD_Tickets t&lt;br /&gt;JOIN HD_Ticket_Activity a&lt;br /&gt;  on t.ID = a.Ticket_ID&lt;br /&gt;WHERE a.ID IN (SELECT a.ID &lt;br /&gt;               FROM HD_Ticket_Activity a&lt;br /&gt;               WHERE a.Ticket_ID = t.ID&lt;br /&gt;                 AND a.Updated_By IN ('juan justo')&lt;br /&gt;--               AND cast(floor(cast(a.Submit_Date as float)) as datetime) &lt;br /&gt;--                     BETWEEN CONVERT(datetime,'2006-01-23',120) &lt;br /&gt;--                         AND CONVERT(datetime,'2006-01-23',120)&lt;br /&gt;             )&lt;br /&gt;GROUP BY t.Ticket&lt;br /&gt;        ,t.Updated_By&lt;br /&gt;        ,t.Summary &lt;br /&gt;        ,a.Updated_By    &lt;br /&gt;        ,t.Status&lt;br /&gt;&lt;br /&gt;The form is working properly, but I have a question, I would like Infopath to ask me for some data before doing the 'query', for instance he 'Updated_By' and Dates that are shown in the SQL statement, I really don't know how to integrate them,&lt;br /&gt;&lt;br /&gt;any advise will be really appreciated,&lt;br /&gt;The best regards,&lt;br /&gt;Carlos&lt;br /&gt;</description></item></channel></rss>