Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            SQLCmd.Connection = DataBaseFactory.Create(new MySqlConnection());
            //  SQLCmd.Insert("trading_test", "Securities").Values("NAME", "TEST2");

            //insert into trading_test.indices (NAME,DESCRIPTION,ASSETCLASS_ID)values('TEST','DAS IST EINE DESCRIPTIOID_N',100)
            //SQLCmd.Insert("trading_test", "indices").Values(
            //    "NAME", "TEST",
            //    "DESCRIPTION", "DAS IST EINE DESCRIPTION",
            //    "ASSETCLASS_ID", 10);

            var lstIndices = new List <Indices>();

            var cmd = SQLCmd.Select("trading_test", "indices").Fields("NAME,DESCRIPTION,ASSETCLASS_ID");

            foreach (var item in cmd.QueryObjects <Indices>())
            {
                lstIndices.Add(item);
            }

            SQLCmd.Connection.Dispose();
            //  SQLCmd.Execute();
            //var sqlCmd = new MySQLCommandBuilder();
            //sqlCmd.Create();
            //sqlCmd.Insert("trading_test", "Securities").Values("NAME", "TEST");


            //DataBaseHelper.OpenConnection();
        }
Ejemplo n.º 2
0
        public static SQLCmd Insert(string database, string table)
        {
            CheckConnection();
            _db    = database;
            _table = table;
            var cmd = new SQLCmd(Connection, SQLCommandTypes.Insert);

            return(cmd);
        }
Ejemplo n.º 3
0
 public static IDataReader CreateQuery(SQLCmd sqlCmd, DbConnection con, MySQLCommandBuilder builder)
 {
     try
     {
         _dbCon             = con;
         _dbCmd             = con.CreateCommand();
         _dbCmd.CommandText = builder.CmdBuilder.ToString();
         return(_dbCmd.ExecuteReader());
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
     return(null);
 }
Ejemplo n.º 4
0
 public static IDataReader Query(SQLCmd sqlCmd)
 {
     return(DbTools.CreateQuery(sqlCmd, Connection, _builder));
 }