First of all, please comply to the Richard's instructions.
Here you've got an example how to achieve that:
DataTable dt = new DataTable();
string commandtext = "Select SCENARIO from EMPLOYEE_BASE_DATA where SCENARIO =@scenario";
using(SqlConnection connection = new SqlConnection("connection_string_here"))
{
connection.Open();
using(SqlCommand command = new SqlCommand(commandtext, connection)
{
command.Parameters.Add("@scenario", SqlDbType.NVarChar){Value = TextBoxUSERID.Text};
using(SqlDataReader reader = command.ExecuteReader())
dt.Load(reader);
}
connection.Close();
}
If you would like to get sum column, take a look at below code:
DataTable dt = new DataTable();
dt.Columns.AddRange(new DataColumn[]
{
new DataColumn("Money1", typeof(double)),
new DataColumn("Money2", typeof(double)),
new DataColumn("Money3", typeof(double)),
new DataColumn("Money4", typeof(double))
});
dt.Rows.Add(new object[]{5, 12, 3.3, 8.8});
dt.Rows.Add(new object[]{8.2, 10.4, 3.3, 8.8});
dt.Rows.Add(new object[]{9.5, 8.2, 5.3, 8.6});
dt.Rows.Add(new object[]{6.4, 7.6, 4.3, 3.8});
var sumOfColumn1 = dt.AsEnumerable()
.Sum(x=> x.Field<double>("Money1"));