Answers for "oracle c# select query"

C#
0

c# select oracle database

DataSet ds = new DataSet(); 
 using(OracleConnection con  = new OracleConnection(connectionstr))
 {
     using(OracleCommand cmd = con.CreateCommand())
     {
         con.Open();
         cmd.CommandText = "SELECT * FROM all_users";
         OracleDataAdapter adap = new OracleDataAdapter(cmd);
         adap.Fill(ds);
     }
 }
Posted by: Guest on January-21-2021
0

oracle c# select query

public List<Donor> Get()
        {
            //Define fields
            List<Donor> donors = new List<Donor>();
            string query;
            OracleCommand cmd;
            OracleDataReader reader;

            query = "SELECT * FROM ldhc_accounts l JOIN donors d ON l.donor_id = d.id";
            conn.Open();
            cmd = new OracleCommand(query, conn);
            reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                Donor d = new Donor();
                {
                    d.DonorId = Convert.ToInt32(reader["id"]);
                    d.FName = reader["fname"].ToString();
                    donors.Add(d);
                }

            }

            conn.Close();

            return donors;
        }
Posted by: Guest on March-14-2021

C# Answers by Framework

Browse Popular Code Answers by Language