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


C# MySqlDataReader.GetInt16方法代码示例

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


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

示例1: LoadFromDB

 public void LoadFromDB(MySqlDataReader reader)
 {
     if (reader.Read())
     {
         Nickname = (reader.IsDBNull(0) ? null : reader.GetString(0));
         Level = reader.GetInt16(1);
         Exp = reader.GetInt16(2);
     }
 }
开发者ID:SyncZone,项目名称:IndieAPI,代码行数:9,代码来源:UserProfile.cs

示例2: LoadFromDB

        public void LoadFromDB(MySqlDataReader reader)
        {
            Items.Clear();
            while (reader.Read())
            {
                Int32 characterNo = reader.GetInt32(0);
                Int32 characterId = reader.GetInt32(1);
                Character ch = new Character(_user, characterId, characterNo);
                ch.Level = reader.GetInt16(2);
                ch.Exp = reader.GetInt32(3);
                ch.GradeId = reader.GetInt16(4);
                ch.PromotionId = reader.GetInt16(5);

                Items.Add(ch);
            }
        }
开发者ID:SyncZone,项目名称:Examples,代码行数:16,代码来源:InvenCharacter.cs

示例3: btnValider_Click

 // Changement du mot de passe
 private void btnValider_Click(object sender, EventArgs e) {
     // Si tout les champs renseignés
     if (txtAncMdp.Text != "" && txtCnfNouvMdp.Text != "" && txtNouvMdp.Text != "") {
         // ---------- Vérification des informations rentrées ---------------           
         // Vérification que nouveau mot de passe + confirmation soient identiques
         if (txtNouvMdp.Text == txtCnfNouvMdp.Text) {
             // Vérification de la longueur du nouveau mot de passe
             if (txtNouvMdp.TextLength >= Global._MIN_CARAC_PWD) {
                 // Vérification du mot de passe actuel
                 try {
                     cmd = new MySqlCommand("SELECT count(*) FROM utilisateur WHERE idUtilisateur = '" + Global.userId + "' and password = PASSWORD(@pwd)", Global.Connection);
                     MySqlParameter pMdp = new MySqlParameter("@pwd", MySqlDbType.Text);
                     pMdp.Value = txtAncMdp.Text;
                     cmd.Parameters.Add(pMdp);
                     cmd.Prepare();
                     rd = cmd.ExecuteReader();
                     rd.Read();
                     // Si ancien mot de passe OK
                     if (rd.GetInt16(0) == 1) {
                         rd.Close();
                         // MAJ du mot de passe
                         cmd = new MySqlCommand("UPDATE utilisateur SET password = PASSWORD(@pwd) WHERE idUtilisateur = '" + Global.userId + "'", Global.Connection);
                         MySqlParameter pNouvMdp = new MySqlParameter("@pwd", MySqlDbType.Text);
                         pNouvMdp.Value = txtNouvMdp.Text;
                         cmd.Parameters.Add(pNouvMdp);
                         cmd.Prepare();
                         cmd.ExecuteNonQuery();
                         MessageBox.Show("Votre mot de passe a bien été modifié ! ", "Succès", MessageBoxButtons.OK, MessageBoxIcon.Information);
                         rd.Close();
                         // Retour à l'écran principal
                         this.Close();
                     } else {
                         MessageBox.Show("Votre mot de passe actuel est incorrect. Veuillez recommencer.", "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error);
                         txtAncMdp.Text = "";
                         rd.Close();
                     }
                 } catch (MySqlException) {
                     MessageBox.Show("Une erreur est survenue. Le mot de passe n'a pas été changé.", "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error);
                     rd.Close();
                 }
             } else {
                 MessageBox.Show("Le nouveau mot de passe est trop petit : minimum " + Global._MIN_CARAC_PWD + " caractères.", "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 txtNouvMdp.Text = "";
                 txtCnfNouvMdp.Text = "";
             }
         } else {
             MessageBox.Show("Le nouveau mot de passe et sa confirmation ne correspondent pas.", "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error);
             txtNouvMdp.Text = "";
             txtCnfNouvMdp.Text = "";
         }
     } else {
         MessageBox.Show("Veuillez renseigner tous les champs.", "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
开发者ID:nico06530,项目名称:projet_ecole_localcar_user,代码行数:55,代码来源:frmChangementMdp.cs

示例4: LoadFromDB

        public void LoadFromDB(MySqlDataReader reader)
        {
            Decks.ForEach(v => v.Clear());

            while (reader.Read())
            {
                DeckType deckType = (DeckType)reader.GetInt32(0);
                Int32 slotNo = reader.GetInt16(1);
                Int32 characterNo = reader.GetInt32(2);

                this[deckType].Characters[slotNo] = _user.InvenCharacter.Find(characterNo);
            }
        }
开发者ID:SyncZone,项目名称:Examples,代码行数:13,代码来源:PlayDeck.cs

示例5: LoadFromDB

        public void LoadFromDB(MySqlDataReader reader)
        {
            Items.Clear();
            while (reader.Read())
            {
                Int32 itemNo = reader.GetInt32(0);
                Int32 itemId = reader.GetInt32(1);
                Item ch = new Item(_user, itemId, itemNo);
                ch.PromotionId = reader.GetInt16(2);
                ch.Quantity = reader.GetInt32(3);

                Items.Add(ch);
            }
        }
开发者ID:SyncZone,项目名称:Examples,代码行数:14,代码来源:InvenItem.cs

示例6: createUserFromDataReader

        private User createUserFromDataReader(MySqlDataReader dataReader)
        {
            if (!dataReader.HasRows) return null;

            dataReader.Read();
            User user = new User(dataReader["login"].ToString(), dataReader["password"].ToString(),
                        dataReader["name"].ToString());

            EvaluetionMethod em;
            int evaluetionMethod = dataReader.GetInt16("evaluetionMethod");

            if(evaluetionMethod == 0)
                em = EvaluetionMethod.Grade;
            else
                em = EvaluetionMethod.Stars;

            user.setEvaluetionMethodInfo(em, (float) dataReader.GetInt16("lowerLimit"),
                                             (float) dataReader.GetInt16("higherLimit"),
                                              float.Parse(dataReader["step"].ToString()));
            return user;
        }
开发者ID:igorbc,项目名称:PROJETO_FINAL_LC,代码行数:21,代码来源:DaoUser.cs

示例7: LoadFromDB

        public void LoadFromDB(MySqlDataReader reader)
        {
            Items.Clear();
            while (reader.Read())
            {
                Int32 energyId = reader.GetInt16(0);
                Int32 point = reader.GetInt32(1);
                DateTime lastUpdateTime = reader.GetDateTime(2);

                Items.Add(new Data(_user, energyId, point, lastUpdateTime));
            }
        }
开发者ID:SyncZone,项目名称:Examples,代码行数:12,代码来源:Energy.cs

示例8: ReadRelationMember

        /// <summary>
        /// Reads a relation member from the MySqlDataReader
        /// </summary>
        /// <param name="reader">The MySqlDataReader to attempt reading the relation member from</param>
        /// <returns>The relation member read from the MySqlReader</returns>
        private RelationMember ReadRelationMember(MySqlDataReader reader)
        {
            var relation_member = new RelationMember();

            relation_member.MemberType = ConvertMemberType(reader.GetInt16(0));
            relation_member.MemberId = reader.GetInt64(1);
            relation_member.MemberRole = reader.GetString(2);

            return relation_member;
        }
开发者ID:cmberryau,项目名称:data-providers,代码行数:15,代码来源:MySQLDataSource.cs

示例9: constructMedical

 private MedicalInformation constructMedical(MySqlDataReader medicalReader)
 {
     MedicalInformation newMedical = new MedicalInformation();
     newMedical.MedicalID = medicalReader.GetInt16("Medical_ID");
     newMedical.Allergies = SafeGetString(medicalReader, "Allergies");
     newMedical.Medication = SafeGetString(medicalReader, "Medication");
     newMedical.Other = SafeGetString(medicalReader, "Other");
     newMedical.Doctor = medicalReader.GetString("Doctor");
     newMedical.DoctorAddress = constructAddress(medicalReader);
     return newMedical;
 }
开发者ID:CalumMurray,项目名称:TBCN,代码行数:11,代码来源:DatabaseConnection.cs

示例10: constructEmployee

 private Employee constructEmployee(MySqlDataReader staffReader)
 {
     Employee newEmployee = new Employee();
     newEmployee.NINo = staffReader.GetString("National_Insurance_Number");
     newEmployee.FirstName = staffReader.GetString("First_Name");
     newEmployee.LastName = staffReader.GetString("Last_Name");
     newEmployee.Position = staffReader.GetString("Position");
     newEmployee.Gender = staffReader.GetChar("Gender");
     newEmployee.DateStarted = staffReader.GetDateTime("Date_Started");
     newEmployee.DateFinished = SafeGetDateTime(staffReader, "Date_Finished");
     newEmployee.PVGDate = staffReader.GetDateTime("PVG_Date");
     newEmployee.HolidaysEntitled = staffReader.GetInt16("Holidays_Entitled");
     newEmployee.HolidaysTaken = staffReader.GetInt16("Holidays_Taken");
     newEmployee.WeeksHours = staffReader.GetInt16("Hours");
     newEmployee.Address = constructAddress(staffReader);
     newEmployee.DOB = staffReader.GetDateTime("DOB");
     newEmployee.Salary = staffReader.GetDecimal("Salary");
     newEmployee.HomePhone = staffReader.GetString("Home_Phone");
     newEmployee.MobilePhone = staffReader.GetString("Mobile_Phone");
     newEmployee.Email = staffReader.GetString("Email");
     newEmployee.Training = SafeGetString(staffReader, "Training");
     newEmployee.Medical = constructMedical(staffReader);
     //EC...
     return newEmployee;
 }
开发者ID:CalumMurray,项目名称:TBCN,代码行数:25,代码来源:DatabaseConnection.cs

示例11: constructChild

        private Child constructChild(MySqlDataReader childrenReader)
        {
            Child newChild = new Child();
            newChild.ChildID = childrenReader.GetInt32("Child_Id");
            newChild.FirstName = childrenReader.GetString("First_Name");
            newChild.LastName = childrenReader.GetString("Last_Name");
            newChild.Gender = childrenReader.GetChar("Gender");
            newChild.DOB = childrenReader.GetDateTime("DOB");

            newChild.FirstLanguage = childrenReader.GetString("First_Language");
            newChild.RoomAttending = childrenReader.GetString("Room_Attending");
            //newChild.Sibling = SafeGetInt(childrenReader, "Sibling");
            newChild.DateApplied = childrenReader.GetDateTime("Date_Applied");
            newChild.DateLeft = SafeGetDateTime(childrenReader, "Date_Left");
            newChild.Attendance = constructAttendance(childrenReader);
            newChild.ExtraDays = childrenReader.GetInt16("Extra_Days");
            newChild.Teas = childrenReader.GetInt16("Teas");
            newChild.MedicalInfo = constructMedical(childrenReader);

            //newChild.ParentsIDs.Add(childrenReader.GetInt16(16));
            //newChild.EmergencyContactsIDs.Add(childrenReader.GetInt16(16));
            //Get parents
            //foreach (int parentID in selectChildsParentIDs(newChild.ChildID))
            //    newChild.Parents.Add(constructParent(childrenReader, 16));

            ////Get Emergency Contacts
            //foreach (int contactID in selectChildsContactIDs(newChild.ChildID))
            //    newChild.EmergencyContacts.Add(selectEmergencyContact(contactID), 30);
            return newChild;
        }
开发者ID:CalumMurray,项目名称:TBCN,代码行数:30,代码来源:DatabaseConnection.cs

示例12: SetProperty

 public void SetProperty(object obj, SelectQueryFieldStore item,MySqlDataReader rdr)
 {
     var pinfo = obj.GetType().GetProperty(item.Property);
     if (pinfo != null)
     {
         switch (item.Type)
         {
             case SelectQueryFieldStore.DataTypes.Int:
                 pinfo.SetValue(obj, rdr.GetInt32(item.Column), null);
                 break;
             case SelectQueryFieldStore.DataTypes.Bool:
                 pinfo.SetValue(obj, Convert.ToBoolean(rdr.GetInt32(item.Column)), null);
                 break;
             case SelectQueryFieldStore.DataTypes.Float:
                 pinfo.SetValue(obj, rdr.GetFloat(item.Column), null);
                 break;
             case SelectQueryFieldStore.DataTypes.String:
                 pinfo.SetValue(obj, rdr.GetString(item.Column), null);
                 break;
             case SelectQueryFieldStore.DataTypes.Long:
                 pinfo.SetValue(obj, rdr.GetInt64(item.Column), null);
                 break;
             case SelectQueryFieldStore.DataTypes.Short:
                 pinfo.SetValue(obj, rdr.GetInt16(item.Column), null);
                 break;
             default:
                 pinfo.SetValue(obj, rdr.GetString(item.Column), null);
                 break;
         }
     }
 }
开发者ID:Unchated,项目名称:pogee-3d-editor,代码行数:31,代码来源:DatabaseObject.cs

示例13: ReadRelationIdAndMember

        /// <summary>
        /// Reads a relation id and relation member from the MySqlDataReader
        /// </summary>
        /// <param name="reader">The MySqlDataReader to attempt reading the relation id and member from</param>
        /// <returns>The relation member and relation id read from the MySqlReader</returns>
        private Tuple<long, RelationMember> ReadRelationIdAndMember(MySqlDataReader reader)
        {
            var relation_member = new RelationMember();

            relation_member.MemberType = ConvertMemberType(reader.GetInt16(1));
            relation_member.MemberId = reader.GetInt64(2);
            relation_member.MemberRole = reader.GetString(3);

            return new Tuple<long,RelationMember>(reader.GetInt64(0), relation_member);
        }
开发者ID:cmberryau,项目名称:data-providers,代码行数:15,代码来源:MySQLDataSource.cs

示例14: LoadFromDB

        public void LoadFromDB(MySqlDataReader reader)
        {
            Items.Clear();
            while (reader.Read())
            {
                Int32 resourceId = reader.GetInt16(0);
                Int32 point = reader.GetInt32(1);

                Items.Add(new Data(resourceId, point));
            }
        }
开发者ID:SyncZone,项目名称:Examples,代码行数:11,代码来源:Resource.cs

示例15: FillValue

 // 往 dr 填充 r 于 i 索引的值
 public static void FillValue( DbRow dr, MySqlDataReader r, int i )
 {
     switch( dr.parent.columns[ i ].dataType )
     {
     case DbDataTypes.Boolean:
         dr[ i ].Assign( r.GetBoolean( i ) ); break;
     case DbDataTypes.Int8:
         dr[ i ].Assign( r.GetSByte( i ) ); break;
     case DbDataTypes.Int16:
         dr[ i ].Assign( r.GetInt16( i ) ); break;
     case DbDataTypes.Int32:
         dr[ i ].Assign( r.GetInt32( i ) ); break;
     case DbDataTypes.Int64:
         dr[ i ].Assign( r.GetInt64( i ) ); break;
     case DbDataTypes.UInt8:
         dr[ i ].Assign( r.GetByte( i ) ); break;
     case DbDataTypes.UInt16:
         dr[ i ].Assign( r.GetUInt16( i ) ); break;
     case DbDataTypes.UInt32:
         dr[ i ].Assign( r.GetUInt32( i ) ); break;
     case DbDataTypes.UInt64:
         dr[ i ].Assign( r.GetUInt64( i ) ); break;
     case DbDataTypes.Float:
         dr[ i ].Assign( r.GetFloat( i ) ); break;
     case DbDataTypes.Double:
         dr[ i ].Assign( r.GetDouble( i ) ); break;
     case DbDataTypes.DateTime:
         dr[ i ].Assign( r.GetDateTime( i ) ); break;
     case DbDataTypes.String:
         dr[ i ].Assign( r.GetString( i ) ); break;
     case DbDataTypes.Bytes:
         var len = (int)r.GetBytes( i, 0, null, 0, 0 );
         var buf = new byte[ len ];
         r.GetBytes( i, 0, buf, 0, len );
         dr[ i ].Assign( buf );
         break;
     default:
         break;
     }
 }
开发者ID:whuthj,项目名称:69net,代码行数:41,代码来源:MyUtils.cs


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