You can create a method with the following. But this is for SQL server database. You need to change the interfaces for oracle database
//Write the Query
string sqlQuery = “SELECT * FROM table WHERE condition”;
string connectionString = Common.GetAppSetting(SERVER_CONNECTION);
//connect to database
SqlConnection connection = new SqlConnection(connectionString);
//run the SQL query
SqlCommand sqlComm = new SqlCommand(sqlQuery, connection);
SqlParameter myParam = new SqlParameter();
myParam.ParameterName = “@mydate”;
myParam.Value = DateTime;
sqlComm.Parameters.Add(myParam);
sqlComm.Connection.Open();
ArrayList recordList = new ArrayList();
SqlDataReader reader = sqlComm.ExecuteReader();
// add data to Array List
while (reader.Read())
{
object[] values = new object[reader.FieldCount];
reader.GetValues(values);
Employee employee = new Employee();
employee.EmployeeID = values[0].ToString();
employee.Guid = Guid.NewGuid().ToString();
recordList.Add(employee);
}
sqlComm.Connection.Close();
return recordList;