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


C# DB.Read方法代码示例

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


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

示例1: LoadGuildMembers

        public void LoadGuildMembers()
        {
            try
            {
                LoadGuildMemberIds(Character.Network.Guild.Guildid, ref Character.Network.Guild.Members);

                foreach (int m in Character.Network.Guild.Members)
                {
                    Global.guild_player PlayerGuild = new Global.guild_player();
                    PlayerGuild.MemberID = m;

                    DB ms = new DB("SELECT * FROM character WHERE id='" + m + "'");
                    using (System.ObjData.Manager.SqlClient.SqlDataReader reader = ms.Read())
                    {
                        while (reader.Read())
                        {
                            PlayerGuild.Model = reader.GetInt32(3);
                            PlayerGuild.Xsector = reader.GetByte(16);
                            PlayerGuild.Ysector = reader.GetByte(17);
                            PlayerGuild.Level = reader.GetByte(5);
                            PlayerGuild.Name = reader.GetString(2);
                            PlayerGuild.Online = (reader.GetInt32(47) == 1);
                            if (PlayerGuild.Online)
                            {
                                Systems sys = GetPlayerMainid(m);
                                if (sys != null)
                                    Character.Network.Guild.MembersClient.Add(sys.client);
                            }
                        }
                    }
                    ms.Close();

                    DB ms2 = new DB("SELECT * FROM guild_members WHERE guild_member_id='" + m + "'");
                    using (System.ObjData.Manager.SqlClient.SqlDataReader reader2 = ms2.Read())
                    {
                        while (reader2.Read())
                        {
                            PlayerGuild.joinRight = (reader2.GetByte(7) == 1);
                            PlayerGuild.withdrawRight = (reader2.GetByte(8) == 1);
                            PlayerGuild.unionRight = (reader2.GetByte(9) == 1);
                            PlayerGuild.guildstorageRight = (reader2.GetByte(10) == 1);
                            PlayerGuild.noticeeditRight = (reader2.GetByte(11) == 1);
                            PlayerGuild.FWrank = reader2.GetByte(6);
                            PlayerGuild.DonateGP = reader2.GetInt32(4);
                            PlayerGuild.Rank = reader2.GetByte(3);
                        }
                    }

                    ms2.Close();
                    Character.Network.Guild.MembersInfo.Add(PlayerGuild);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
        }
开发者ID:ManhHaHY,项目名称:ClowenEmulationOpenSourceProject,代码行数:57,代码来源:Guild.cs

示例2: LoadGuildMemberIds

 public void LoadGuildMemberIds(int guildid, ref List<int> MemberIDs)
 {
     try
     {
         DB ms = new DB("SELECT * FROM guild_members WHERE guild_id='" + guildid + "'");
         using (System.ObjData.Manager.SqlClient.SqlDataReader reader = ms.Read())
         {
             while (reader.Read())
             {
                 int memberid = reader.GetInt32(2);
                 MemberIDs.Add(memberid);
             }
         }
     }
     catch (Exception ex)
     {
         Log.Exception(ex);
     }
 }
开发者ID:ManhHaHY,项目名称:ClowenEmulationOpenSourceProject,代码行数:19,代码来源:Guild.cs

示例3: LoadPlayerGuildInfo

        public void LoadPlayerGuildInfo(bool logon)
        {
            try
            {
                DB ms = new DB("SELECT * FROM guild_members WHERE guild_member_id='" + Character.Information.CharacterID + "'");
                using (System.ObjData.Manager.SqlClient.SqlDataReader reader = ms.Read())
                {
                    while (reader.Read())
                    {
                        Character.Network.Guild.Guildid = reader.GetInt32(1);
                        Character.Network.Guild.GrantName = reader.GetString(5);
                        Character.Network.Guild.FWrank = reader.GetByte(6);
                        Character.Network.Guild.DonateGP = reader.GetInt32(4);
                        Character.Network.Guild.LastDonate = Character.Network.Guild.DonateGP;
                        Character.Network.Guild.joinRight = (reader.GetByte(7) == 1);
                        Character.Network.Guild.withdrawRight = (reader.GetByte(8) == 1);
                        Character.Network.Guild.unionRight = (reader.GetByte(9) == 1);
                        Character.Network.Guild.guildstorageRight = (reader.GetByte(10) == 1);
                        Character.Network.Guild.noticeeditRight = (reader.GetByte(11) == 1);
                    }
                }
                ms.Close();

                DB ms2 = new DB("SELECT * FROM guild WHERE id='" + Character.Network.Guild.Guildid + "'");
                using (System.ObjData.Manager.SqlClient.SqlDataReader reader2 = ms2.Read())
                {
                    while (reader2.Read())
                    {
                        Character.Network.Guild.Name = reader2.GetString(1);
                        Character.Network.Guild.Level = reader2.GetByte(2);
                        Character.Network.Guild.PointsTotal = reader2.GetInt32(3);
                        Character.Network.Guild.NewsTitle = reader2.GetString(4);
                        Character.Network.Guild.NewsMessage = reader2.GetString(5);
                        Character.Network.Guild.StorageSlots = reader2.GetInt32(7);
                        Character.Network.Guild.Wargold = reader2.GetInt32(8);
                        Character.Network.Guild.StorageGold = reader2.GetInt64(11);
                        //Character.Network.Guild.MasterID = reader.GetInt32(9);
                    }
                }
                ms2.Close();

                DB ms3 = new DB("SELECT * FROM guild_members WHERE guild_id='" + Character.Network.Guild.Guildid + "'");
                Character.Network.Guild.TotalMembers = Convert.ToByte(ms3.Count());

                //Only load on player login
                if (logon)
                {
                    LoadGuildMembers();
                }
            }
            catch (Exception ex)
            {
                Log.Exception(ex);
                Console.WriteLine("LoadPlayerGuildInfo error {0}", ex);
            }
        }
开发者ID:ManhHaHY,项目名称:ClowenEmulationOpenSourceProject,代码行数:56,代码来源:Guild.cs


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