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


C# IDatabase.ExecuteReader方法代码示例

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


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

示例1: LoadDetailsFromDatabase

        public void LoadDetailsFromDatabase(IDatabase database)
        {
            var c =
                database.ExecuteReader("SELECT * FROM characters WHERE character_id=" + Id).ToDictionary();
            if (c.Count == 0)
                throw new Exception("c.Count == 0");

            AccountId = (UInt32) c["account_id"];
            Name = (string) c["name"];
            Race = (byte) c["race"];
            Class = (byte) c["class"];
            Level = (byte) c["level"];
            Experience = (UInt32) c["Experience"];
            Sex = (byte) c["sex"];
            RealmId = (byte) c["realm_id"];
            Map = (UInt32) c["map_id"];
            Language = (string) c["language"];
            HeadMesh = (UInt32) c["headmesh"];
            Size = (byte) c["size"];
            Voice = (byte) c["voice"];
            LastConnection = (UInt32) c["last_connection"];
            Position = new Vector3((float) c["pos_x"], (float) c["pos_y"], (float) c["pos_z"]);
            Rotation = new Vector3((float) c["rot_x"], (float) c["rot_y"], (float) c["rot_z"]);
            Lbinprv = (UInt32) c["lbinprv"];
        }
开发者ID:wwhitehead,项目名称:ProjectFaolan,代码行数:25,代码来源:Character.cs

示例2: LoadDetailsFromDatabase

        public void LoadDetailsFromDatabase(IDatabase database)
        {
            Dictionary<string, dynamic> obj;
            if (Id != 0)
                obj = database.ExecuteReader("SELECT * FROM accounts WHERE account_id=" + Id).ToDictionary();
            else if (Name != null)
                obj = database.ExecuteReader("SELECT * FROM accounts WHERE username='" + Name + "'").ToDictionary();
            else
                throw new Exception("Id == 0 && Username == null");

            if (obj.Count == 0)
                throw new Exception("obj.Count == 0");

            Id = (UInt32) obj["account_id"];
            Name = obj["username"];
            Type = (AccountType) obj["type"];
            State = (AccountState) obj["state"];
        }
开发者ID:wwhitehead,项目名称:ProjectFaolan,代码行数:18,代码来源:Account.cs

示例3: GetCharacters

        public Character[] GetCharacters(IDatabase database)
        {
            var chars = database.ExecuteReader("SELECT character_id FROM characters WHERE account_id=" + Id)
                .ToIEnumerable().Select(c => new Character((UInt32) c["character_id"])).ToArray();

            foreach (var c in chars)
                c.LoadDetailsFromDatabase(database);

            return chars;
        }
开发者ID:wwhitehead,项目名称:ProjectFaolan,代码行数:10,代码来源:Account.cs

示例4: Init

 public static void Init(IDatabase database)
 {
     AllMaps = database.ExecuteReader("SELECT * FROM maps").ToIEnumerable().Select(c => new ConanMap
     {
         Id = (UInt32) c["map_id"],
         Name = (string) c["map_name"],
         Position = new Vector3((float) c["pos_x"], (float) c["pos_y"], (float) c["pos_z"]),
         Rotation = new Vector3((float) c["rot_x"], (float) c["rot_y"], (float) c["rot_z"])
     }).ToArray();
 }
开发者ID:wwhitehead,项目名称:ProjectFaolan,代码行数:10,代码来源:ConanMap.cs

示例5: Init

 public static void Init(IDatabase database)
 {
     AllSpells = database.ExecuteReader("SELECT * FROM spells").ToIEnumerable().Select(c => new Spell
     {
         Id = (UInt32) c["id"],
         Level = (byte) c["level"],
         Name = (string) c["name"],
         CastTime = (UInt16) c["castTime"],
         MinDamage = (UInt16) c["minDmg"],
         MaxDamage = (UInt16) c["maxDmg"],
         ManaCost = (UInt16) c["costMana"],
         EffectSpell = (UInt32) c["effectSpell"]
     }).ToArray();
 }
开发者ID:wwhitehead,项目名称:ProjectFaolan,代码行数:14,代码来源:Spell.cs

示例6: GetAllDiagnosesFromHistory

        /// <summary>
        /// Should be called 1 time when loading the program
        /// </summary>
        /// <param name="db"></param>
        /// <returns></returns>
        internal static List<string> GetAllDiagnosesFromHistory(IDatabase db)
        {
            List<string> result = new List<string>();
            string strCommand = BuildStringCommandGettingFieldsFromTableWithoutCondition(ClinicConstant.HistoryTable,new List<string>(){ ClinicConstant.HistoryTable_Diagnose});
            using (DbDataReader reader = db.ExecuteReader(strCommand, null) as DbDataReader)
            {
                while (reader.Read())
                {
                    try
                    {
                        if (!result.Contains(reader[ClinicConstant.HistoryTable_Diagnose].ToString()))
                        {
                            result.Add(reader[ClinicConstant.HistoryTable_Diagnose].ToString());
                        }
                    }
                    catch (Exception e)
                    {

                    }
                }
            }
            return result;
        }
开发者ID:ninianh,项目名称:PhongKham,代码行数:28,代码来源:Helper.cs

示例7: checkVisitExistsDoanhThu

        internal static bool checkVisitExistsDoanhThu(IDatabase db, string Id, string visitDate)
        {
            string strCommand = "SELECT Idpatient FROM doanhthu WHERE Idpatient = " + ConvertToSqlString(Id) + " AND time=" + ConvertToSqlString(visitDate) + ";";
            //MySqlCommand comm = new MySqlCommand(strCommand, conn);
            DbDataReader reader = db.ExecuteReader(strCommand, null) as DbDataReader;
            reader.Read();
            try
            {
                return reader.HasRows;
            }
            finally
            {
                reader.Close();

            }
        }
开发者ID:ninianh,项目名称:PhongKham,代码行数:16,代码来源:Helper.cs

示例8: DoanhThuTheoThang

        internal static List<ItemDoanhThu> DoanhThuTheoThang(IDatabase db, DateTime dateTime)
        {
            List<ItemDoanhThu> result = new List<ItemDoanhThu>();

            string strCommand = " SELECT * FROM doanhthu   WHERE month(time) = " + dateTime.Month.ToString();
            using (DbDataReader reader = db.ExecuteReader(strCommand, null) as DbDataReader)
            {
                while (reader.Read())
                {
                    ItemDoanhThu item = new ItemDoanhThu();
                    item.Date = reader.GetDateTime(reader.GetOrdinal(ClinicConstant.DoanhThuTable_Time)).ToString("dd-MM-yyyy");
                    item.NameOfDoctor = reader[ClinicConstant.DoanhThuTable_Namedoctor].ToString();
                    item.Money = (int)reader[ClinicConstant.DoanhThuTable_Money];
                    item.IdPatient = reader[ClinicConstant.DoanhThuTable_IdPatient].ToString();
                    item.NamePatient = reader[ClinicConstant.DoanhThuTable_NamePatient].ToString();
                    item.Services = reader[ClinicConstant.DoanhThuTable_Services].ToString();
                    item.LoaiKham = reader[ClinicConstant.DoanhThuTable_LoaiKham].ToString();

                    try
                    {
                        int idHistory = (int)reader[ClinicConstant.HistoryTable_IdHistory];
                        item.Diagnose = GetDiagnoseFromHistoryByIdHistory(idHistory, DatabaseFactory.Instance2);
                    }
                    catch { item.Diagnose = ""; }
                    if (result.Where(x => x.IdPatient == item.IdPatient && x.Date == item.Date).FirstOrDefault() == null)
                    {
                        result.Add(item);
                    }

                }
            }

            return result;
        }
开发者ID:ninianh,项目名称:PhongKham,代码行数:34,代码来源:Helper.cs

示例9: hasOtherNameForThisId

        public static string hasOtherNameForThisId(IDatabase db, string Id, string name)
        {
            string strCommand = "SELECT name FROM Patient WHERE Idpatient = " + ConvertToSqlString(Id);
            //MySqlCommand comm = new MySqlCommand(strCommand, conn);
            DbDataReader reader = db.ExecuteReader(strCommand, null) as DbDataReader;
            reader.Read();

            try
            {
                if (reader.HasRows)
                {
                    if (reader.GetValue(0) as string != name)
                    {
                        return reader.GetValue(0) as string;
                    }
                    else
                    {
                        return null;
                    }
                }
                else
                {
                    return null;
                }
            }
            finally
            {
                reader.Close();

            }
        }
开发者ID:ninianh,项目名称:PhongKham,代码行数:31,代码来源:Helper.cs

示例10: CheckMedicineExists

        internal static bool CheckMedicineExists(IDatabase db, string Id)
        {
            string strCommand = "SELECT Id FROM medicine WHERE Id = " + ConvertToSqlString(Id);
            DbDataReader reader = db.ExecuteReader(strCommand, null) as DbDataReader;
            reader.Read();

            try
            {
                return reader.HasRows;
            }
            finally
            {
                reader.Close();

            }
        }
开发者ID:ninianh,项目名称:PhongKham,代码行数:16,代码来源:Helper.cs

示例11: GetNameOfDoctor

        internal static string GetNameOfDoctor(IDatabase db, string name)
        {
            string strCommand = "SELECT * FROM clinicuser where Username = " + Helper.ConvertToSqlString(name);
            DbDataReader reader = db.ExecuteReader(strCommand, null) as DbDataReader;
            reader.Read();

            try
            {
                return reader["namedoctor"].ToString();
            }
            finally
            {
                reader.Close();

            }
        }
开发者ID:ninianh,项目名称:PhongKham,代码行数:16,代码来源:Helper.cs

示例12: GetAllDateOfUser

 public static List<ADate> GetAllDateOfUser(string Username, IDatabase db)
 {
     List<ADate> ListDate = new List<ADate>();
     string strCommand = "Select * from calendar where Username = " + Helper.ConvertToSqlString(Username);
     DbDataReader reader = db.ExecuteReader(strCommand, null) as DbDataReader;
     while (reader.Read())
     {
         ListDate.Add(BoxingDate(reader));
     }
     reader.Close();
     return ListDate;
 }
开发者ID:ninianh,项目名称:PhongKham,代码行数:12,代码来源:Helper.cs

示例13: GetListPatientToday

        internal static Dictionary<string, string> GetListPatientToday(IDatabase db)
        {
            Dictionary<string, string> result = new Dictionary<string, string>();

            string strCommand = "SELECT * FROM listpatienttoday";
            DbDataReader reader = db.ExecuteReader(strCommand, null) as DbDataReader;

            try
            {
                while (reader.Read())
                {
                    if (reader.HasRows)
                    {
                        result.Add(reader["Id"].ToString(), reader["name"].ToString() + ";" + reader["state"].ToString());
                    }

                }
                return result;
            }
            finally
            {
                reader.Close();

            }
        }
开发者ID:ninianh,项目名称:PhongKham,代码行数:25,代码来源:Helper.cs

示例14: GetIdMedicineFromName

 internal static string GetIdMedicineFromName(IDatabase db, string name)
 {
     string id = "";
     string strCommand = "Select Id from medicine where Name = " +ConvertToSqlString(name)  ;
     using (DbDataReader reader = db.ExecuteReader(strCommand, null) as DbDataReader)
     {
         reader.Read();
         if (reader.HasRows)
         {
             id = reader[DatabaseContants.medicine.Id].ToString();
         }
     }
     return id;
 }
开发者ID:ninianh,项目名称:PhongKham,代码行数:14,代码来源:Helper.cs

示例15: SameAddressAndName

        internal static bool SameAddressAndName(IDatabase db, string name, string address)
        {
            string strCommand = "SELECT Name,Address FROM Patient WHERE Name = " + ConvertToSqlString(name) + " and " + "Address = " + ConvertToSqlString(address);
            DbDataReader reader = db.ExecuteReader(strCommand, null) as DbDataReader;
            reader.Read();

            try
            {
                return reader.HasRows;
            }
            finally
            {
                reader.Close();

            }
        }
开发者ID:ninianh,项目名称:PhongKham,代码行数:16,代码来源:Helper.cs


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