예제 #1
0
        public static MyNesDBColumn GetColumn(string colName)
        {
            if (myconnection == null)
            {
                throw new Exception("The SQLite connection is not running, can't make any requests.");
            }
            MyNesDBColumn entry = new MyNesDBColumn();

            entry.Name = colName;
            using (SQLiteTransaction mytransaction = myconnection.BeginTransaction())
            {
                using (SQLiteCommand mycommand = new SQLiteCommand(myconnection))
                {
                    mycommand.CommandText = "SELECT [Visible] FROM COLUMNS WHERE [Column Name]='" + colName + "';";
                    bool bval = false;
                    bool.TryParse(mycommand.ExecuteScalar().ToString(), out bval);
                    entry.Visible = bval;

                    mycommand.CommandText = "SELECT [Width] FROM COLUMNS WHERE [Column Name]='" + colName + "';";
                    int val = 0;
                    int.TryParse(mycommand.ExecuteScalar().ToString(), out val);
                    entry.Width = val;
                }
                mytransaction.Commit();
            }
            return(entry);
        }
예제 #2
0
        public static MyNesDBColumn[] GetColumns()
        {
            if (myconnection == null)
            {
                throw new Exception("The SQLite connection is not running, can't make any requests.");
            }
            List <MyNesDBColumn> columns = new List <MyNesDBColumn>();

            SQLiteDataAdapter db  = new SQLiteDataAdapter("select * from COLUMNS;", myconnection);
            DataSet           set = new DataSet();

            db.Fill(set);
            for (int i = 0; i < set.Tables[0].Rows.Count; i++)
            {
                MyNesDBColumn col = new MyNesDBColumn();
                col.Name = (string)set.Tables[0].Rows[i]["Column Name"];

                bool vis = true;
                bool.TryParse(set.Tables[0].Rows[i]["Visible"].ToString(), out vis);
                col.Visible = vis;

                int w = 70;
                int.TryParse(set.Tables[0].Rows[i]["Width"].ToString(), out w);
                col.Width = w;
                columns.Add(col);
            }
            return(columns.ToArray());
        }
예제 #3
0
파일: MyNesDB.cs 프로젝트: Blizz9/FanCut
        public static MyNesDBColumn[] GetColumns()
        {
            if (myconnection == null)
            {
                throw new Exception("The SQLite connection is not running, can't make any requests.");
            }
            List<MyNesDBColumn> columns = new List<MyNesDBColumn>();

            SQLiteDataAdapter db = new SQLiteDataAdapter("select * from COLUMNS;", myconnection);
            DataSet set = new DataSet();
            db.Fill(set);
            for (int i = 0; i < set.Tables[0].Rows.Count; i++)
            {
                MyNesDBColumn col = new MyNesDBColumn();
                col.Name = (string)set.Tables[0].Rows[i]["Column Name"];

                bool vis = true;
                bool.TryParse(set.Tables[0].Rows[i]["Visible"].ToString(), out vis);
                col.Visible = vis;

                int w = 70;
                int.TryParse(set.Tables[0].Rows[i]["Width"].ToString(), out w);
                col.Width = w;
                columns.Add(col);
            }
            return columns.ToArray();
        }
예제 #4
0
파일: MyNesDB.cs 프로젝트: Blizz9/FanCut
        public static MyNesDBColumn GetColumn(string colName)
        {
            if (myconnection == null)
            {
                throw new Exception("The SQLite connection is not running, can't make any requests.");
            }
            MyNesDBColumn entry = new MyNesDBColumn();
            entry.Name = colName;
            using (SQLiteTransaction mytransaction = myconnection.BeginTransaction())
            {
                using (SQLiteCommand mycommand = new SQLiteCommand(myconnection))
                {
                    mycommand.CommandText = "SELECT [Visible] FROM COLUMNS WHERE [Column Name]='" + colName + "';";
                    bool bval = false;
                    bool.TryParse(mycommand.ExecuteScalar().ToString(), out bval);
                    entry.Visible = bval;

                    mycommand.CommandText = "SELECT [Width] FROM COLUMNS WHERE [Column Name]='" + colName + "';";
                    int val = 0;
                    int.TryParse(mycommand.ExecuteScalar().ToString(), out val);
                    entry.Width = val;
                }
                mytransaction.Commit();
            }
            return entry;
        }