Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

SharePoint App SQL Error

$
0
0

Hi there,
I created an app that contains list in it, I'm overriding ItemAdded class to do calculations and some parsing after item is created.
I want to store some number in SQL server and later add those in calculations.

My connection string:

string result;
            string connectionString = "Data Source=MyDB;Initial Catalog=MyCatalog;Trusted_Connection=true;User ID=12345;Password=12345;";
            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                using (SqlCommand command = new SqlCommand(
                             "SELECT blalalala, connection))
                {
                    connection.Open();
                    result = (string)command.ExecuteScalar();                   
                }
            }

And i get error, on line "connection.Open();":"An exception of type 'System.Security.SecurityException' occurred in System.Data.dll but was not handled in user codeAdditional information: Request for the permission of type 'System.Data.SqlClient.SqlClientPermission, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed."

In web.config file i got "<trust level="Full" originUrl="" legacyCasModel="true" />" so problem shouldn't be there.

Any Ideas?


Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>