I need to get the return of a select
that comes from a procedure
.
I've seen about using ExecuteReader
, but I'm not getting the data that's coming.
procedure
is up to date
Since the return of procedure
will be something of the type and both varchar
.
Item | Name Item
given to | given b
given c | given c
I thought of creating an array of 2 per n lines.
The problem is when it arrives at ExecuteReader
to get the values of the item and item name
Here's my code
string[][] retorno = new string[2][];
string constr = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString;
using(SqlConnection con = new SqlConnection(constr))
{
using (SqlCommand cmd = new SqlCommand("Sp_SelectContratoGestores"))
{
cmd.CommandTimeout = 300;
cmd.CommandType = CommandType.StoredProcedure;
cmd.Connection = con;
con.Open();
while (cmd.ExecuteReader().Read())
{
retorno[0][contador] = cmd.ExecuteReader().ToString();
contador++;
}
con.Close();
}
}