title: sharepoint2010 : database connection in sandboxed web part
body: <p>I want to make database connection in sandboxed web part. Following code works fine when i am using queries. Can anybody tell me how to use stored procedure &amp; passing parameters to it? Also how to work with web service?</p>
  
  <pre><code>    public static DataSet ChkConn(string strval)
      {
          public static DataSet ds;        
          public static string assemblyName = "FullTrustProxy, Version=1.0.0.0, Culture=Neutral, PublicKeyToken=75e25e9dc5ff21aa";
          public static string typeName = "DBFullTrust.FullTrustProxy.SQLFullTrustProxy";
  
          try
          {
              SQLProxyArgs proxyArgs = new SQLProxyArgs();
              proxyArgs.ConnectionString = "Persist Security Info=False;User ID=sa;Password=;Initial Catalog=Cat;Data Source=ABC";
              if (strval == "B")
                  proxyArgs.Command = "select * from table1";
              else
                  proxyArgs.Command = "select * from table2";
  
  
              proxyArgs.returnType = typeof(DataSet);
              return ds = (DataSet)SPUtility.ExecuteRegisteredProxyOperation(assemblyName, typeName, proxyArgs);                 
          }
          catch
          {
  
          }
          return ds;
      }
  </code></pre>