Exemple #1
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);
 }
Exemple #2
0
 private static void Create()
 {
     if (_instance == null)
     {
         _instance = new DataBasePDA();
         _instance.ConnectToBase(ConnectionString);
     }
 }
Exemple #3
0
 public static void Disconnect()
 {
     if (_instance != null)
     {
         _instance.DisconnectFromBase();
         _instance = null;
     }
 }
Exemple #4
0
 public static void Disconnect()
 {
     if (_instance != null)
     {
         _instance.DisconnectFromBase();
         _instance = null;
     }
 }
Exemple #5
0
 private static void Create()
 {
     if (_instance == null)
     {
         _instance = new DataBasePDA();
         _instance.ConnectToBase(ConnectionString);
     }
 }
Exemple #6
0
        public override bool Execute(string SQL)
        {
            bool         Res     = true;
            SqlCeCommand command = new SqlCeCommand(SQL, DataBasePDA.Get());

            try
            {
                command.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                Res        = false;
                pErrorMsg  = ex.Message;
                pErrorCode = -1;
            }
            return(Res);
        }