<?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: The name ' ' does not exist in the current context</title><link>https://www.infopathdev.com:443/forums/thread/20359.aspx</link><pubDate>Mon, 04 Jun 2007 16:35:48 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:20359</guid><dc:creator>Greg Collins</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/20359.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=47&amp;PostID=20359</wfw:commentRss><description>&lt;p&gt;You should be able to change out your code to use VB.NET instead of C# if you are more comfortable with that. I don&amp;#39;t have the exact steps, but they shouldn&amp;#39;t be too hard to find.&lt;/p&gt;&lt;p&gt;For the IP07 OM, the MSDN site is the first place I&amp;#39;d go... &lt;a href="http://www.msdn.com/"&gt;http://www.msdn.com&lt;/a&gt;. I don&amp;#39;t know of any others at this time.&lt;/p&gt;&lt;p&gt;If you stick with C#, you define your variables in a similar way to VB:&lt;/p&gt;&lt;p&gt;int currentElementID;&lt;br /&gt;string myDataAdapter;&lt;/p&gt;</description></item><item><title>Re: The name ' ' does not exist in the current context</title><link>https://www.infopathdev.com:443/forums/thread/20279.aspx</link><pubDate>Wed, 30 May 2007 16:48:51 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:20279</guid><dc:creator>grimreaper0</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/20279.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=47&amp;PostID=20279</wfw:commentRss><description>&lt;p&gt;Greg, Thanks for the fast reply. &lt;/p&gt;&lt;p&gt;You are right about the OM i am trying to cut and paste from various examples i have found on sites to get the code to work as it is new to me. Can you recommend a could reference site for the new 07 OM? Other than using the help file.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;I suppose i dont define either currentElementID or myDataAdapter anywhere in the form. I actually am unsure where. In VB i would simply use something such as:&lt;/p&gt;&lt;p&gt;DIM currentElementID as integer, myDataAdapter as text&lt;/p&gt;&lt;p&gt;can i define the same way here?&lt;/p&gt;</description></item><item><title>Re: The name ' ' does not exist in the current context</title><link>https://www.infopathdev.com:443/forums/thread/20278.aspx</link><pubDate>Wed, 30 May 2007 16:41:21 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:20278</guid><dc:creator>Greg Collins</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/20278.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=47&amp;PostID=20278</wfw:commentRss><description>&lt;p&gt;You are stuck with different object models. You are currently working in the InfoPath 2007 OM (as identified by the fact that you have a &amp;quot;_Clicked&amp;quot; function and not an &amp;quot;_OnClick&amp;quot; function. Yet you are trying to use the InfoPath 2003 OM to write your code. This won&amp;#39;t work.&lt;/p&gt;&lt;p&gt;You will either need to change your form to use the InfoPath 2003 OM and then use the coding style&amp;nbsp;you are familiar with, or learn how to use the new InfoPath 2007 OM to code.&lt;/p&gt;&lt;p&gt;For Error 1, did you define currentElementID as a string anywhere? It doesn&amp;#39;t look like it in your code sample above. The same question in regards to all the other variables you are using.&lt;/p&gt;</description></item><item><title>Re: The name ' ' does not exist in the current context</title><link>https://www.infopathdev.com:443/forums/thread/20277.aspx</link><pubDate>Wed, 30 May 2007 16:37:04 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:20277</guid><dc:creator>grimreaper0</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/20277.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=47&amp;PostID=20277</wfw:commentRss><description>Sorry for doubling up some of the code. I tried editing it and it keeps posting some stuff twice.</description></item><item><title>The name ' ' does not exist in the current context</title><link>https://www.infopathdev.com:443/forums/thread/20274.aspx</link><pubDate>Wed, 30 May 2007 16:32:07 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:20274</guid><dc:creator>grimreaper0</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/20274.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=47&amp;PostID=20274</wfw:commentRss><description>&lt;p&gt;I am having the above problem in my code. I have searched the forum and have read the different ways of getting this to go away with no success. I am extremely new to infopath and .net. I&amp;nbsp;am familiar with VB but not C#,&amp;nbsp;unfortuanelty most examples are in C# so im trying to learn. Any help would be much appreciated. Thanks.&lt;/p&gt;&lt;p&gt;&lt;font size="2"&gt;&lt;p&gt;&lt;font size="2"&gt;&lt;p&gt;&lt;font color="#008000" size="2"&gt;&lt;/font&gt;&lt;/p&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font color="#008000" size="2"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font color="#008000" size="2"&gt;&lt;/font&gt;&lt;/p&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font size="2"&gt;&lt;p&gt;&lt;font color="#008000" size="2"&gt;&lt;/font&gt;&lt;/p&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font color="#008000" size="2"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font color="#008000" size="2"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font size="2"&gt;&lt;p&gt;&lt;font color="#008000" size="2"&gt;&lt;/font&gt;&lt;/p&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font color="#008000" size="2"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font color="#008000" size="2"&gt;&lt;/font&gt;&lt;/p&gt;&lt;font color="#0000ff" size="2"&gt;public&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;void&lt;/font&gt;&lt;font size="2"&gt; CTRL60_4_Clicked(&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;object&lt;/font&gt;&lt;font size="2"&gt; sender, &lt;/font&gt;&lt;font color="#008080" size="2"&gt;ClickedEventArgs&lt;/font&gt;&lt;font size="2"&gt; e) &lt;p&gt;{&lt;/p&gt;&lt;p&gt;&lt;font color="#008000" size="2"&gt;// get the value of the DOM node that we&amp;rsquo;ll use to append to the WHERE clause&lt;/font&gt;&lt;font size="2"&gt;&lt;p&gt;currentElementID = XDocument.DOM.selectSingleNode(&lt;font color="#800000" size="2"&gt;&amp;quot;/dfs:myFields/dfs:queryFields/q:_08-Estimate_tbl/@Cost_Center&amp;quot;&lt;/font&gt;&lt;font size="2"&gt;).text; &lt;p&gt;&lt;font size="2"&gt;&lt;p&gt;&lt;font color="#008000" size="2"&gt;&lt;/font&gt;&lt;/p&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font color="#008000" size="2"&gt;&lt;/font&gt;&lt;/p&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font size="2"&gt;&lt;p&gt;&lt;font color="#008000" size="2"&gt;&lt;/font&gt;&lt;/p&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font color="#008000" size="2"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font size="2"&gt;&lt;p&gt;&lt;font color="#008000" size="2"&gt;&lt;/font&gt;&lt;/p&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font color="#008000" size="2"&gt;&lt;/font&gt;&lt;/p&gt;&lt;/font&gt;&lt;/p&gt;&lt;/font&gt;&lt;font color="#008000" size="2"&gt;// get the value of the DOM node that we&amp;rsquo;ll use to append to the WHERE clause&lt;/font&gt;&lt;font size="2"&gt;&lt;p&gt;currentElementID = XDocument.DOM.selectSingleNode(&lt;font color="#800000" size="2"&gt;&amp;quot;/dfs:myFields/dfs:queryFields/q:_08-Estimate_tbl/@Cost_Center&amp;quot;&lt;/font&gt;&lt;font size="2"&gt;).text; &lt;p&gt;&lt;font size="2"&gt;&lt;p&gt;&lt;font color="#008000" size="2"&gt;&lt;/font&gt;&lt;/p&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font color="#008000" size="2"&gt;&lt;/font&gt;&lt;/p&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font size="2"&gt;&lt;p&gt;&lt;font color="#008000" size="2"&gt;&lt;/font&gt;&lt;/p&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font color="#008000" size="2"&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font size="2"&gt;&lt;p&gt;&lt;font color="#008000" size="2"&gt;&lt;/font&gt;&lt;/p&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font color="#008000" size="2"&gt;&lt;/font&gt;&lt;/p&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;p&gt;&lt;font color="#008000" size="2"&gt;&lt;/font&gt;&lt;/p&gt;&lt;/font&gt;&lt;font color="#008000" size="2"&gt;// get the data adapter object&lt;/font&gt;&lt;font size="2"&gt; &lt;p&gt;myDataAdapter = XDocument.DataAdapters(&lt;font color="#800000" size="2"&gt;&amp;quot;Actuals&amp;quot;&lt;/font&gt;&lt;font size="2"&gt;); &lt;p&gt;&lt;font color="#008000" size="2"&gt;// set the SQL command property of the data adapter, providing a dynamic WHERE clause&lt;/font&gt;&lt;/p&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font color="#008000" size="2"&gt;// set the SQL command property of the data adapter, providing a dynamic WHERE clause&lt;/font&gt;&lt;/p&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;p&gt;myDataAdapter.Command = &lt;font color="#800000" size="2"&gt;&amp;quot;SELECT DISTINCTROW Job Number as Job_Number, Cost Center as Cost_Center, Year, Month-Year, Sum(Actual Labor Costs) AS Sum_Of_Actual_Labor_Costs, Sum(Actual Non-Labor Costs) AS Sum_Of_Actual_Non-Labor_Costs, Sum(Total Actual Costs) AS Sum_Of_Total_Actual_Costs FROM actuals GROUP BY Job Number, Cost Center, Year, Month-Year&amp;quot;&lt;/font&gt;&lt;font size="2"&gt;;&lt;/font&gt; &lt;/p&gt;&lt;p&gt;&lt;font color="#008000" size="2"&gt;&amp;nbsp;&lt;/font&gt;&lt;font color="#008000" size="2"&gt;// execute the query&lt;/font&gt;&lt;font size="2"&gt; &lt;p&gt;myDataAdapter.Query();&lt;/p&gt;&lt;p&gt;}&lt;/p&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;myDataAdapter.Query();&lt;/p&gt;&lt;p&gt;}&lt;/p&gt;&lt;/font&gt;&lt;font color="#008000" size="2"&gt;&amp;nbsp;&lt;/font&gt;&lt;font color="#008000" size="2"&gt;// execute the query&lt;/font&gt;&lt;font size="2"&gt; &lt;p&gt;myDataAdapter.Query();&lt;/p&gt;&lt;p&gt;}&lt;/p&gt;&lt;/font&gt;&lt;p&gt;Errors are:&lt;/p&gt;&lt;p&gt;&amp;nbsp;Error&amp;nbsp;1&amp;nbsp;The name &amp;#39;currentElementID&amp;#39; does not exist in the current context&amp;nbsp;\My Documents\InfoPath Projects\SO Admin v91\FormCode.cs&amp;nbsp;38&amp;nbsp;13&amp;nbsp;SO Admin v9&lt;br /&gt;Error&amp;nbsp;2&amp;nbsp;The name &amp;#39;XDocument&amp;#39; does not exist in the current context&amp;nbsp;\My Documents\InfoPath Projects\SO Admin v91\FormCode.cs&amp;nbsp;38&amp;nbsp;32&amp;nbsp;SO Admin v9&lt;br /&gt;Error&amp;nbsp;3&amp;nbsp;The name &amp;#39;myDataAdapter&amp;#39; does not exist in the current context&amp;nbsp;\My Documents\InfoPath Projects\SO Admin v91\FormCode.cs&amp;nbsp;41&amp;nbsp;13&amp;nbsp;SO Admin v9&lt;br /&gt;Error&amp;nbsp;4&amp;nbsp;The name &amp;#39;XDocument&amp;#39; does not exist in the current context&amp;nbsp;\My Documents\InfoPath Projects\SO Admin v91\FormCode.cs&amp;nbsp;41&amp;nbsp;29&amp;nbsp;SO Admin v9&lt;br /&gt;Error&amp;nbsp;5&amp;nbsp;The name &amp;#39;myDataAdapter&amp;#39; does not exist in the current context&amp;nbsp;\My Documents\InfoPath Projects\SO Admin v91\FormCode.cs&amp;nbsp;45&amp;nbsp;13&amp;nbsp;SO Admin v9&lt;br /&gt;Error&amp;nbsp;6&amp;nbsp;The name &amp;#39;myDataAdapter&amp;#39; does not exist in the current context&amp;nbsp;\My Documents\InfoPath Projects\SO Admin v91\FormCode.cs&amp;nbsp;48&amp;nbsp;13&amp;nbsp;SO Admin v9&lt;br /&gt;&lt;/p&gt;</description></item></channel></rss>