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


C# MySqlDataReader.Dispose方法代码示例

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


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

示例1: executarConsulta

 public MySqlDataReader executarConsulta(MySqlCommand cmm)
 {
     conectar();
     cmm.Connection = conn;
     try
     {
         dr = cmm.ExecuteReader();
     }
     catch (MySqlException ex)
     {
         dr.Dispose();
         throw ex;
     }
     return dr;
 }
开发者ID:raquelaresi,项目名称:LPOOII---2015---Marcelo-e-Raquel---OdontoSystem,代码行数:15,代码来源:DataBase.cs

示例2: JsonSend

        public void JsonSend(string[] jSon)
        {
            if (DataToConnect == null || !_isEnabled) return;
            try
            {

                if (jSon.Length != 4) throw new Exception("This is not property jSon data.");
                //Prepare a new _connection
                _connection = new MySqlConnection(DataToConnect);

                //open mysql client
                _connection.Open();

                string latin1Command1 = UTF8toLatin
                    ($"insert into dane(IDUrzadzenia, dane, czas, data) values('{jSon[0]}','{jSon[1]}','{jSon[2]}','{jSon[3]}');");
                _categoriesCommand = new MySqlCommand(latin1Command1, _connection);

                _reader = _categoriesCommand.ExecuteReader();
                while (_reader.Read())
                {
                }
                _reader.Dispose();

                SendMessage("Log sent to Remote database.");
            }
            catch
            {
                SendMessage("Can't connect to remote database! Check all.");
            }
        }
开发者ID:pozzzima123,项目名称:TcpListenerRTM,代码行数:30,代码来源:LoggingMysql.cs

示例3: ReadTotal

    public static string ReadTotal(string query,string row,string morequery = null)
    {
        try{
            if (con.State.ToString() != "Open")
                con.Open();
            using(con){
                using(cmd = new MySqlCommand(query, con)){
                    rdr = cmd.ExecuteReader();

                    if(rdr.HasRows)
                        while (rdr.Read())
                            Debug.Log(rdr[row].ToString());
                    rdr.Dispose();
                }
            }
        }
        catch (Exception ex){
            return ex.ToString();
        }
        return "";
    }
开发者ID:JuanJSAR,项目名称:InMySQL,代码行数:21,代码来源:InMySQL.cs

示例4: ReadEntries

	// Read all entries from the table
	void ReadEntries()
	{
		string query = string.Empty;
		if (_GameItems == null)
			_GameItems = new List<data>();
		if (_GameItems.Count > 0)
			_GameItems.Clear();
		// Error trapping in the simplest form
		try
		{
			query = "SELECT * FROM view_demo";
			if (con.State.ToString() != "Open")
				con.Open();
			using (con)
			{
				using (cmd = new MySqlCommand(query, con))
				{
					rdr = cmd.ExecuteReader();
					if (rdr.HasRows)
						while (rdr.Read())
					{
						data itm = new data();
						itm.UID = int.Parse(rdr["iddemo_table"].ToString());
						itm.ID = rdr["ID"].ToString();
						itm.levelname = rdr["levelname"].ToString();
						itm.Name = rdr["Name"].ToString();
						itm.objectType = rdr["objectType"].ToString();
						itm.posx = float.Parse(rdr["posx"].ToString());
						itm.posy = float.Parse(rdr["posy"].ToString());
						itm.posz = float.Parse(rdr["posz"].ToString());
						itm.tranx = float.Parse(rdr["tranx"].ToString());
						itm.trany = float.Parse(rdr["trany"].ToString());
						itm.tranz = float.Parse(rdr["tranz"].ToString());
						_GameItems.Add(itm);
					}
					rdr.Dispose();
				}
			}
		}
		catch (Exception ex)
		{
			Debug.Log(ex.ToString());
		}
		finally
		{
		}
	}
开发者ID:MarcelMC,项目名称:UnityGamee,代码行数:48,代码来源:mysqloryginal.cs

示例5: LogIn

    void LogIn(NetworkMessage netMsg, InfoMessage msg)
    {
        bool loggedIn = false;
        string query = "SELECT * FROM shogi.players WHERE players_email = \"" + msg.email + "\"";
        if (con.State.ToString () != "Open")
            con.Open ();

        using (con) {

            using (cmd = new MySqlCommand (query, con)) {
                rdr = cmd.ExecuteReader();
                if (rdr.HasRows) {
                    rdr.Read ();
                    if (msg.password == rdr["players_password"].ToString ()) {
                        incomeMessages.text += netMsg.conn.address + " logged in as " + msg.email + "\n";
                        loggedIn = true;
                    }
                    else
                        incomeMessages.text += netMsg.conn.address + " failed logging in for wrong password " + msg.password + "\n";
                }
                else
                    incomeMessages.text += netMsg.conn.address + " failed logging in for no entry " + msg.email + "\n";
                rdr.Dispose ();
            }

            string queryIP = "UPDATE shogi.players SET players_ip = \"" + netMsg.conn.address + "\" WHERE players_email = \"" + msg.email + "\"";
            if (loggedIn) {
                using (cmd = new MySqlCommand (queryIP, con))
                    cmd.ExecuteNonQuery ();
                msg.goal = "loggedin";
                NetworkServer.SendToClient(netMsg.conn.connectionId, MyMsgType.Info, msg);
            }
        }
    }
开发者ID:Fayanzar,项目名称:ShogiServer,代码行数:34,代码来源:InitNetwork.cs

示例6: executarConsulta

        public MySqlDataReader executarConsulta(string pSql)
        {
            conectarDB();
            cmm = new MySqlCommand(pSql, conn);

            try
            {
                dr = cmm.ExecuteReader();
            }
            catch (MySqlException ex)
            {
                dr.Dispose();
                throw ex;
            }

            return dr;
        }
开发者ID:Feldens00,项目名称:Music-Empire,代码行数:17,代码来源:DataBase.cs

示例7: LoadGameState

        /// <summary>
        /// Load gamestate from current player
        /// </summary>
        /// <param name="result"></param>
        public void LoadGameState(MySqlDataReader result)
        {
            result.Read();

            player.Gold = result.GetInt32(1);
            this.turn = result.GetInt32(2);
            List<Cargo> clist = player.GetPlayersCargoList();
            int i = 3;
            foreach (Cargo cargo in player.GetPlayersCargoList())
            {
                cargo.Amount = result.GetInt32(i);
                i++;
            }

            foreach (Port port in portList)
            {
                i=12;
                foreach (Cargo cargo in port.GetPortsCargoList())
                {
                    cargo.Price = result.GetInt32(i);
                    i++;
                }
            }

            result.Dispose();
        }
开发者ID:EricNordlund,项目名称:PirateWars,代码行数:30,代码来源:Game.cs


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