// Set the connection, command, and then execute the command with query and return the reader.
public static SqlOutput<DataTable> ExecuteReader(String connectionString, String commandText,
CommandType commandType = CommandType.Text, params SqlParameter[] parameters)
{
return Execute(cmd =>
{
using (SqlDataReader reader = cmd.ExecuteReader())
{
while (reader.Read()) // HERE THE ERROR IS HAPPENING
{
Console.WriteLine(String.Format("{0}", reader[0]));
}
}
return new DataTable();
}, commandType, parameters);
}
var result = SqlHelper.ExecuteReader(ConnectionString, input.script, System.Data.CommandType.Text, input.parameters.Select(x => // input.parameters = @[{'E48CC209-4D6A-4594-BD02-AE74DBCF82EA'}]
{
var p = new SqlParameter(x.Key, System.Data.SqlDbType.UniqueIdentifier);
p.Value = Guid.Parse(x.Value);
return p;
}).ToArray());
// Set the connection, command, and then execute the command with query and return the reader.
public static SqlOutput<DataTable> ExecuteReader(String connectionString, String commandText,
CommandType commandType = CommandType.Text, params SqlParameter[] parameters)
{
return Execute(cmd =>
{
using (SqlDataReader reader = cmd.ExecuteReader())
{
while (reader.Read()) // HERE THE ERROR IS HAPPENING
{
Console.WriteLine(String.Format("{0}", reader[0]));
}
}
return new DataTable();
}, commandType, parameters);
}
var result = SqlHelper.ExecuteReader(ConnectionString, input.script, System.Data.CommandType.Text, input.parameters.Select(x => // input.parameters = @[{'E48CC209-4D6A-4594-BD02-AE74DBCF82EA'}]
{
var p = new SqlParameter(x.Key, System.Data.SqlDbType.UniqueIdentifier);
p.Value = Guid.Parse(x.Value);
return p;
}).ToArray());