<?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>Code</title><link>https://www.infopathdev.com:443/forums/45.aspx</link><description /><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: accessing sql server in C# code on form load</title><link>https://www.infopathdev.com:443/forums/thread/80616.aspx</link><pubDate>Mon, 16 Jul 2012 08:19:09 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:80616</guid><dc:creator>rajkumar.bathula</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/80616.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=80616</wfw:commentRss><description>&lt;p&gt;Hi&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;as Jimmy said, give full trust by navigating to Form options--&amp;gt;Security--&amp;gt; and select full trust. &lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: accessing sql server in C# code on form load</title><link>https://www.infopathdev.com:443/forums/thread/80214.aspx</link><pubDate>Wed, 04 Jul 2012 14:45:32 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:80214</guid><dc:creator>Jimmy</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/80214.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=80214</wfw:commentRss><description>&lt;p&gt;As far as I know, the only way to use code like the above to access a database is for your form to be full trust.&lt;/p&gt;&lt;p&gt;Instead, you should set up a data connection to the SQL server, and if necessary, manipulate that from code.&lt;/p&gt;</description></item><item><title>Re: accessing sql server in C# code on form load</title><link>https://www.infopathdev.com:443/forums/thread/80211.aspx</link><pubDate>Wed, 04 Jul 2012 14:16:27 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:80211</guid><dc:creator>RodrigoBR</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/80211.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=80211</wfw:commentRss><description>&lt;p&gt;Hi raj,&lt;/p&gt;&lt;p&gt;I am facing the same situation, have you solve it?&lt;/p&gt;</description></item><item><title>accessing sql server in C# code on form load</title><link>https://www.infopathdev.com:443/forums/thread/73630.aspx</link><pubDate>Sun, 08 Jan 2012 18:45:09 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:73630</guid><dc:creator>rajkumar.bathula</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/73630.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=73630</wfw:commentRss><description>&lt;p&gt;Hi, I am unable to connect to MS SQL server database in form load code in C#. I am using infopath 2010. It gives permission exception(Detailed exception given below). &lt;/p&gt;
&lt;p&gt;Please help me out in geting rid of this issue.&lt;/p&gt;
&lt;p&gt;&lt;u&gt;Below is code i am using in my Form load:&lt;/u&gt;&lt;/p&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;using&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; (&lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;&lt;font color="#2b91af" size="2"&gt;SqlConnection&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; conn = &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;new&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;&lt;font color="#2b91af" size="2"&gt;SqlConnection&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;(&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot;Data Source=systemName\\servername;Initial Catalog=SharePoint_DB;User ID=admin;Password=Pass01*;Integrated Security=true;&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;))&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;conn.Open();&lt;/p&gt;emailAlias.SetValue(&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot;xyz&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;);&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;conn.Close();&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;u&gt;Exception at connection Open() statement :&lt;/u&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;[System.Security.SecurityException] = {&amp;quot;Request for the permission of type &amp;#39;System.Data.SqlClient.SqlClientPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089&amp;#39; failed.&amp;quot;}&lt;/strong&gt;&lt;/p&gt;&lt;/font&gt;
&lt;p&gt;thanks beforehand&lt;/p&gt;
&lt;p&gt;raj &lt;br /&gt;&lt;/p&gt;</description></item></channel></rss>