asked on
private DataTable GetRecords()
{
using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ToString()))
{
// Open the connection.
conn.Open();
SqlCommand command = new SqlCommand();
command.Connection = conn;
command.CommandTimeout = 15;
command.CommandType = CommandType.StoredProcedure;
command.CommandText = "storedprocedureconnect";
command.Parameters.Add("@paramvalue1", SqlDbType.VarChar, 6).Value = "myvalue";
command.Parameters.Add("@paramvalue2", SqlDbType.Int).Value = 0;
SqlDataAdapter dA = new SqlDataAdapter();
DataSet objDs = new DataSet();
dA.SelectCommand = command;
dA.Fill(objDs);
return objDs.Tables[0];
}
}
And convert it to use