1static public object ExecuteStored(string NomeStored, string ConnectionString, params SqlParameter[] Ingresso)
2{
3 System.Data.SqlClient.SqlCommand sql = null;
4 System.Data.SqlClient.SqlConnection conn = null;
5 object ValRet = null;
6 try
7 {
8 conn = new System.Data.SqlClient.SqlConnection(ConnectionString);
9 conn.Open();
10
11 sql = new System.Data.SqlClient.SqlCommand(NomeStored, conn);
12 sql.CommandType = CommandType.StoredProcedure;
13 sql.Parameters.AddRange(Ingresso);
14 sql.CommandTimeout = 0;
15 ValRet = sql.ExecuteScalar();
16 }
17 catch (Exception ex)
18 {
19 throw ex;
20 }
21 finally
22 {
23 sql.Dispose();
24 conn.Close();
25 conn.Dispose();
26 }
27 return ValRet;
28}