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); }
private static void Create() { if (_instance == null) { _instance = new DataBasePDA(); _instance.ConnectToBase(ConnectionString); } }
public static void Disconnect() { if (_instance != null) { _instance.DisconnectFromBase(); _instance = null; } }
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); }