Example #1
0
        public override bool Select(string SQL)
        {
            OracleCommand    command = new OracleCommand(SQL, DataBaseOracle.Get());
            OracleDataReader reader;

            try
            {
                reader = command.ExecuteReader();
            }
            catch (Exception)
            {
                return(false);
            }
            DataRows row;

            Rows = new List <DataRows>();
            while (reader.Read())
            {
                row = new DataRows();
                for (int i = 0; i < reader.FieldCount; i++)
                {
                    row.AddField(new DataField(reader.GetName(i), Convert.ToString(reader.GetValue(i))));
                }
                Rows.Add(row);
            }
            DataBaseOracle.Disconnect();
            return(true);
        }
Example #2
0
 public override bool Select(string SQL)
 {
     pErrorMsg  = "No error";
     pErrorCode = 0;
     try
     {
         SqlCeCommand command = new SqlCeCommand(SQL, DataBasePDA.Get());
         RecordSet    Set     = new RecordSet(command.ExecuteReader());
         Set.Next();
         string[] fields = Set.Fileds();
         Rows = new List <DataRows>();
         while (!Set.Eof)
         {
             DataRows row = new DataRows();
             foreach (string fieldname in fields)
             {
                 row.AddField(new DataField(fieldname, Set.FieldByName(fieldname)));
             }
             Rows.Add(row);
             Set.Next();
         }
     }
     catch (Exception ex)
     {
         pErrorMsg  = ex.Message;
         pErrorCode = 1;
         throw;
         //return false;
     }
     return(true);
 }