当前位置: 首页>>代码示例>>C#>>正文


C# SqliteCommand.ExecuteReader方法代码示例

本文整理汇总了C#中Mono.Data.Sqlite.SqliteCommand.ExecuteReader方法的典型用法代码示例。如果您正苦于以下问题:C# SqliteCommand.ExecuteReader方法的具体用法?C# SqliteCommand.ExecuteReader怎么用?C# SqliteCommand.ExecuteReader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mono.Data.Sqlite.SqliteCommand的用法示例。


在下文中一共展示了SqliteCommand.ExecuteReader方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ExecuteQuery

 static public SqliteDataReader ExecuteQuery(string sqlQuery)
 {
     dbCommand = OpenDB("monsters.db").CreateCommand();
     dbCommand.CommandText = sqlQuery;
     reader = dbCommand.ExecuteReader();
     return reader;
 }
开发者ID:shuitian,项目名称:pokemon_rpg,代码行数:7,代码来源:Sql.cs

示例2: vapdata

        private void vapdata()
        {
            tcenti = int.Parse(temp.Text);
            tk = 273.15 + tcenti;
            con.Open();
            
            string stm = "SELECT * FROM VAPDATA2 WHERE Name ='"+comppicker.SelectedItem+"'";

            using (SqliteCommand cmd = new SqliteCommand(stm, con))
            {
                using (SqliteDataReader rdr = cmd.ExecuteReader())
                {
                    while (rdr.Read())
                    {
                        ct1 = double.Parse(rdr["C1"].ToString());
                        ct2 = double.Parse(rdr["C2"].ToString());
                        ct3 = double.Parse(rdr["C3"].ToString());
                        ct4 = double.Parse(rdr["C4"].ToString());
                        ct5 = double.Parse(rdr["C5"].ToString());
                    }
                }
            }
            con.Close();

            vpresure = (Math.Exp(ct1 + (ct2 / tk) + ct3 * Math.Log(tk) + ct4 * Math.Pow(tk, ct5)) / 100000);
            vp.Text = vpresure.ToString();
        }
开发者ID:sabarinadhamara,项目名称:PCWindows,代码行数:27,代码来源:VapourPressure.xaml.cs

示例3: InsertData

 public void InsertData(string scene, string posx,string posy)
 {
     _query = "INSERT INTO continar VALUES('PEPE','"+scene+"','"+posx+"','"+ posy +"')";//continar?
     _command = _conexion.CreateCommand ();
     _command.CommandText = _query;
     _command.ExecuteReader ();
 }
开发者ID:Lex92,项目名称:Programacion-3,代码行数:7,代码来源:dbConection.cs

示例4: InsertMonsters

    public void InsertMonsters()
    {
        string[] nombres = SaveMonster.GetMonsterList();
        Monstruo temp;

        if (PlayerPrefs.GetString ("botonPresionado") == "new") {
            DeleteMonsters();
        }

        for(int i = 0;i < nombres.Length;++i){
            temp = SaveMonster.LoadMonster(nombres[i]);
            _query="SELECT * FROM tablaMonstruos WHERE owner='PEPE' and name='"+temp.nombre+"'";
            _command = _conexion.CreateCommand ();
            _command.CommandText = _query;
            _reader = _command.ExecuteReader ();
            int cont=0;
            if(_reader != null){
                while(_reader.Read()){
                    cont++;
                }
                if(cont!=0){
                    _query= "UPDATE tablaMonstruos set specie='"+temp.especie+"',exp='"+temp.exp.ToString()+"',modStats='"+temp.modStats.ToString()+"',estado='"+temp.estado.ToString()+"' WHERE owner='PEPE' and name='"+temp.nombre+"'";
                }else{
                    _query = "INSERT INTO tablaMonstruos VALUES('"+temp.nombre+"','"+temp.especie+"','"+temp.exp.ToString()+"','"+temp.modStats.ToString()+"','"+temp.estado.ToString()+"','PEPE')";
                }

            }
            _command = _conexion.CreateCommand();
            _command.CommandText = _query;
            _command.ExecuteReader();
        }
    }
开发者ID:Lex92,项目名称:Programacion-3,代码行数:32,代码来源:dbConection.cs

示例5: DeleteMonsters

 public void DeleteMonsters()
 {
     _query = "DELETE FROM tablaMonstruos WHERE owner='PEPE'";
     _command = _conexion.CreateCommand ();
     _command.CommandText = _query;
     _command.ExecuteReader ();
 }
开发者ID:Lex92,项目名称:Programacion-3,代码行数:7,代码来源:dbConection.cs

示例6: CrearTablaMonstruos

 public void CrearTablaMonstruos(string tabla)
 {
     _query = "CREATE TABLE "+tabla+" (name CHAR(20), specie CHAR(20), exp CHAR(40), modstats CHAR(100), estado CHAR(100), owner CHAR(20));";
     _command = _conexion.CreateCommand();
     _command.CommandText = _query;
     _command.ExecuteReader();
 }
开发者ID:Lex92,项目名称:Programacion-3,代码行数:7,代码来源:dbConection.cs

示例7: CrearTabla

 public void CrearTabla(string tabla)
 {
     _query = "CREATE TABLE "+tabla+"(name CHAR(20) NOT NULL, scene CHAR(20), posicionX CHAR (20), posicionY CHAR(20));";
     _command = _conexion.CreateCommand();
     _command.CommandText = _query;
     _command.ExecuteReader();
 }
开发者ID:Lex92,项目名称:Programacion-3,代码行数:7,代码来源:dbConection.cs

示例8: ExecuteQuery

 static List<Dictionary<string, object>> ExecuteQuery(string query, List<SqliteParameter> pars)
 {
     List<Dictionary<string, object>> res = new List<Dictionary<string, object>>();
     using (var Conn = GetConnection())
     {
         Conn.Open();
         using (SqliteCommand command = new SqliteCommand(query, Conn))
         {
             foreach (var par in pars)
                 command.Parameters.Add(par);
             using (var reader = command.ExecuteReader())
             {
                 if (reader.HasRows)
                 {
                     while (reader.Read())
                     {
                         res.Add(new Dictionary<string, object>());
                         for (int i = 0; i < reader.FieldCount; i++)
                         {
                             res[res.Count - 1][reader.GetName(i)] = reader[i];
                         }
                     }
                 }
             }
         }
     }
     return res;
 }
开发者ID:ren85,项目名称:cfs,代码行数:28,代码来源:SqliteOps.cs

示例9: ExecuteStringCommand

        public static List<string[]> ExecuteStringCommand(SqliteCommand command, int columncount)
        {
            try
            {
            var values = new List<string[]>();
            SqliteDataReader reader = command.ExecuteReader();
            while (reader.Read())
            {
                var row = new List<string>();
                for (int i = 0; i < reader.FieldCount; i++)
                {
                    row.Add(reader[i].ToString());
                }
                values.Add(row.ToArray());
            }
            reader.Close();
            return values;

            }
            catch (Exception ex)
            {
            MessageBox.Show(ex.Message);
            return new List<string[]>();
            }
        }
开发者ID:salvadorc17,项目名称:YGOPRO-Tools,代码行数:25,代码来源:DatabaseHelper.cs

示例10: Init

        public static void Init()
        {
            try
            {
                _cards = new Dictionary<int, CardData>();

                string currentPath = Assembly.GetExecutingAssembly().Location;
                currentPath = Path.GetDirectoryName(currentPath) ?? "";
                string absolutePath = Path.Combine(currentPath, "cards.cdb");

                if (!File.Exists(absolutePath))
                {
                    throw new Exception("Could not find the cards database.");
                }

                using (SqliteConnection connection = new SqliteConnection("Data Source=" + absolutePath))
                {
                    connection.Open();

                    const string select =
                        "SELECT datas.id, alias, type, level, race, attribute, atk, def, name, desc " +
                        "FROM datas INNER JOIN texts ON datas.id = texts.id";

                    using (SqliteCommand command = new SqliteCommand(select, connection))
                    using (SqliteDataReader reader = command.ExecuteReader())
                        InitCards(reader);
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Could not initialize the cards database. Check the inner exception for more details.", ex);
            }
        }
开发者ID:Tic-Tac-Toc,项目名称:windbot,代码行数:33,代码来源:CardsManager.cs

示例11: CommitTransaction

        public void CommitTransaction()
        {
            var lst = new List<string>();
            using (var cmd = new SqliteCommand(String.Format("SELECT DISTINCT [TableName] FROM {0}", TranStatusTable), ActiveConnection))
            {
                using (SqliteDataReader r = cmd.ExecuteReader())
                {
                    while (r.Read())
                    {
                        lst.Add(r.GetString(0));
                    }
                }
            }

            SqliteTransaction tran = ActiveConnection.BeginTransaction();
            try
            {
                foreach (String tableName in lst)
                {
                    using (var cmd = new SqliteCommand(String.Format("DELETE FROM __{0}", tableName), tran.Connection, tran))
                        cmd.ExecuteNonQuery();
                }
                using (var cmd = new SqliteCommand(String.Format("DELETE FROM {0}", TranStatusTable), tran.Connection, tran))
                    cmd.ExecuteNonQuery();

                tran.Commit();
            }
            catch
            {
                tran.Rollback();
                throw;
            }
        }
开发者ID:Fedorm,项目名称:core-master,代码行数:33,代码来源:DatabaseTransaction.cs

示例12: UpdateOrders

    public void UpdateOrders()
    {
        MainClass.StatusMessage("Получаем таблицу заказов...");

        string sql = "SELECT orders.id, orders.customer, orders.contract, orders.address, orders.phone1, orders.phone2, orders.arrval, orders.deadline_s, orders.deadline_e FROM orders ";
        SqliteCommand cmd = new SqliteCommand(sql, (SqliteConnection) QSMain.ConnectionDB);

        using(SqliteDataReader rdr = cmd.ExecuteReader())
        {
            OrdersListStore.Clear();
            while (rdr.Read())
            {
                OrdersListStore.AppendValues(rdr.GetInt32(rdr.GetOrdinal("id")),
                    rdr["customer"].ToString(),
                    rdr["contract"].ToString(),
                    rdr["phone1"].ToString() + rdr["phone2"].ToString(),
                    rdr["address"].ToString(),
                    String.Format("{0:d}", rdr["arrval"]),
                    DateWorks.GetDateRangeText(DBWorks.GetDateTime(rdr, "deadline_s", new DateTime()), DBWorks.GetDateTime(rdr, "deadline_e", new DateTime()))
                );
            }

        }
        MainClass.StatusMessage("Ok");
    }
开发者ID:QualitySolution,项目名称:CupboardDesigner,代码行数:25,代码来源:MainWinOrders.cs

示例13: Init

        public static void Init(string databaseFullPath)
        {
            try
            {
                if (!File.Exists(databaseFullPath))
                {
                    throw new Exception("Could not find the cards database.");
                }

                _cards = new Dictionary<int, NamedCard>();

                using (SqliteConnection connection = new SqliteConnection("Data Source=" + databaseFullPath))
                {
                    connection.Open();

                    using (IDbCommand command = new SqliteCommand(
                        "SELECT datas.id, ot, alias, setcode, type, level, race, attribute, atk, def, texts.name, texts.desc"
                        + " FROM datas INNER JOIN texts ON datas.id = texts.id",
                        connection))
                    {
                        using (IDataReader reader = command.ExecuteReader())
                        {
                            while (reader.Read())
                            {
                                LoadCard(reader);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Could not initialize the cards database. Check the inner exception for more details.", ex);
            }
        }
开发者ID:mycard,项目名称:ygosharp,代码行数:35,代码来源:NamedCardsManager.cs

示例14: GetAllCategories

        /// <summary>
        /// Returns all categories.
        /// </summary>
        public IEnumerable<Category> GetAllCategories()
        {
            var categories = new List<Category>();

            using (var connection = new SqliteConnection("Data Source=" + dbPath))
            using (var query = new SqliteCommand("SELECT * FROM Categories", connection))
            {
                connection.Open();

                var reader = query.ExecuteReader(CommandBehavior.CloseConnection);

                while (reader.Read())
                {
                    var category = new Category();
                    category.Id = int.Parse(reader["id"].ToString());
                    category.Name = reader ["name"].ToString();

                    categories.Add(category);
                }

                reader.Close();
            }

            return categories;
        }
开发者ID:CayasSoftware,项目名称:RSSReader,代码行数:28,代码来源:CategoryRepository.cs

示例15: liqviscdata

        private void liqviscdata()
        {

            con.Open();

            string stm = "SELECT * FROM windowsdata WHERE comp='"+comppicker.SelectedItem+"' ORDER BY comp ";

            using (SqliteCommand cmd = new SqliteCommand(stm, con))
            {
                using (SqliteDataReader rdr = cmd.ExecuteReader())
                {
                    while (rdr.Read())
                    {
                        tcenti = double.Parse(temp.Text);
                        tk = tcenti + 273.15;
                        viscb =double.Parse( rdr["viscb"].ToString());
                        viscc = double.Parse(rdr["viscc"].ToString());
                        if (viscc != 0)
                        {
                            double visc1 = viscb * ((1 / tk) - (1 / viscc));
                            double viscocity = Math.Pow(10, visc1);
                            Liqvisc.Text = viscocity.ToString();
                        }
                        else
                        {
                            Liqvisc.Text = "0"; 
                        }
                        
                    }
                }
            }
            con.Close();
        }
开发者ID:sabarinadhamara,项目名称:PCWindows,代码行数:33,代码来源:LiquidViscosity.xaml.cs


注:本文中的Mono.Data.Sqlite.SqliteCommand.ExecuteReader方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。