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


C# OdbcDataReader.GetDateTime方法代码示例

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


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

示例1: readUser

 /// <summary>
 /// Constructs a user from the output of a datareader. Assumes that there is data
 /// ready to be read from the current record 14/12/15
 /// </summary>
 private static User readUser(OdbcDataReader dataReader)
 {
     return new User(dataReader.GetInt16(0), dataReader.GetString(1),
     dataReader.GetString(3), dataReader.GetString(4), dataReader.GetString(5),
     dataReader.GetBoolean(6), dataReader.GetDateTime(7), dataReader.GetInt16(8),
     dataReader.GetInt16(9), dataReader.GetBoolean(10), dataReader.GetBoolean(11),
     dataReader.GetInt16(13));
 }
开发者ID:LordJameh,项目名称:Computing-Project,代码行数:12,代码来源:Database.cs

示例2: readAchievement

 /// <summary>
 /// Constructs an achievement from the output of a datareader. Assumes that there
 /// is data ready to be read from the current record 14/12/15
 /// </summary>
 private static Achievement readAchievement(OdbcDataReader dataReader)
 {
     return new Achievement(dataReader.GetInt16(0), dataReader.GetString(1),
     dataReader.GetString(2), dataReader.GetString(3), dataReader.GetString(4),
     dataReader.GetInt16(5), dataReader.GetDateTime(6), dataReader.GetBoolean(7));
 }
开发者ID:LordJameh,项目名称:Computing-Project,代码行数:10,代码来源:Database.cs

示例3: GetUserFromReader

        //
        // GetUserFromReader
        //    A helper function that takes the current row from the OdbcDataReader
        // and hydrates a MembershiUser from the values. Called by the
        // MembershipUser.GetUser implementation.
        //
        private MembershipUser GetUserFromReader(OdbcDataReader reader)
        {
            object providerUserKey = reader.GetValue(0);
            string username = reader.GetString(1);
            string email = reader.GetString(2);

            string passwordQuestion = "";
            if (reader.GetValue(3) != DBNull.Value)
                passwordQuestion = reader.GetString(3);

            string comment = "";
            if (reader.GetValue(4) != DBNull.Value)
                comment = reader.GetString(4);

            bool isApproved = reader.GetBoolean(5);
            bool isLockedOut = reader.GetBoolean(6);
            DateTime creationDate = reader.GetDateTime(7);

            DateTime lastLoginDate = new DateTime();
            if (reader.GetValue(8) != DBNull.Value)
                lastLoginDate = reader.GetDateTime(8);

            DateTime lastActivityDate = reader.GetDateTime(9);
            DateTime lastPasswordChangedDate = reader.GetDateTime(10);

            DateTime lastLockedOutDate = new DateTime();
            if (reader.GetValue(11) != DBNull.Value)
                lastLockedOutDate = reader.GetDateTime(11);

            MembershipUser u = new MembershipUser((this.Name == null) ? "SimpleMysqlMembershipProvider" : this.Name,
                                                  username,
                                                  providerUserKey,
                                                  email,
                                                  passwordQuestion,
                                                  comment,
                                                  isApproved,
                                                  isLockedOut,
                                                  creationDate,
                                                  lastLoginDate,
                                                  lastActivityDate,
                                                  lastPasswordChangedDate,
                                                  lastLockedOutDate);

            return u;
        }
开发者ID:windrobin,项目名称:3D-Repository,代码行数:51,代码来源:MysqlMembershipProvider.cs

示例4: GetUserFromReader

        private OpenIdMembershipUser GetUserFromReader(OdbcDataReader reader)
        {
            string username = reader.GetString(0);

            string openId = reader.IsDBNull(1) ? string.Empty : reader.GetString(1);
            string email = reader.IsDBNull(2) ? string.Empty : reader.GetString(2);
            string passwordQuestion = "";
            if (reader.GetValue(3) != DBNull.Value)
                passwordQuestion = reader.GetString(3);

            string comment = "";
            if (reader.GetValue(4) != DBNull.Value)
                comment = reader.GetString(4);

            bool isApproved = reader.GetBoolean(5);

            DateTime creationDate = reader.GetDateTime(6);

            DateTime lastLoginDate = new DateTime();
            if (reader.GetValue(7) != DBNull.Value)
                lastLoginDate = reader.GetDateTime(7);

            DateTime lastActivityDate = reader.GetDateTime(8);

            DateTime lastPasswordChangedDate = reader.GetDateTime(9);

            object providerUserKey = reader.GetValue(10);

            bool isLockedOut = reader.GetBoolean(11);

            DateTime lastLockedOutDate = new DateTime();
            if (reader.GetValue(12) != DBNull.Value)
                lastLockedOutDate = reader.GetDateTime(12);

            OpenIdMembershipUser u = new OpenIdMembershipUser(
                                                  this.Name,
                                                  openId,
                                                  username,
                                                  providerUserKey,
                                                  email,
                                                  passwordQuestion,
                                                  comment,
                                                  isApproved,
                                                  isLockedOut,
                                                  creationDate,
                                                  lastLoginDate,
                                                  lastActivityDate,
                                                  lastPasswordChangedDate,
                                                  lastLockedOutDate);

            return u;
        }
开发者ID:adlnet,项目名称:3D-Repository,代码行数:52,代码来源:OpenIdMembershipProvider.cs

示例5: LogMessageOnDatabase

        protected bool LogMessageOnDatabase(OdbcDataReader toSend)
        {
            try
             {
            string query = "INSERT INTO SMS_Log (MobilePhone, SMS_Day, SMS_Hour, SMS_Text, DateTimeSent, ID_Group, SMS_Sent) VALUES ('" +
                           toSend["MobilePhone"].ToString() + "', '" + toSend["SMS_Day"].ToString() + "', '" + ((DateTime)toSend.GetDateTime(toSend.GetOrdinal("SMS_Hour"))).ToString("hh:mm:ss") + "', '" +
                           toSend["SMS_Text"].ToString() + "', '" + DateTime.Now + "', '" + toSend["ID_Group"].ToString() + "', '" +
                           DateTime.Now + "')";

            int r = database.ExecuteCommand(query);

            if (r < 1)
               return false;

            return true;
             }
             catch (Exception ex)
             {
            if (Debug)
               Console.WriteLine("Engine.LogMessageOnDatabase Exception: {0}", ex.Message);

            return false;
             }
        }
开发者ID:JauchOnGitHub,项目名称:csharptoolbox,代码行数:24,代码来源:Engine.cs

示例6: GetNullableDatetime

 public static DateTime? GetNullableDatetime(OdbcDataReader reader, string columnName)
 {
     int x = reader.GetOrdinal(columnName);
     return reader.IsDBNull(x) ? (DateTime?)null : reader.GetDateTime(x);
 }
开发者ID:yoismelp,项目名称:TestScriptLink2YP,代码行数:5,代码来源:Helper.cs

示例7: GetProfileInfoFromReader

        //
        // GetProfileInfoFromReader
        //  Takes the current row from the OdbcDataReader
        // and populates a ProfileInfo object from the values.
        //
        private ProfileInfo GetProfileInfoFromReader(OdbcDataReader reader)
        {
            string username = reader.GetString(0);

            DateTime lastActivityDate = new DateTime();
            if (reader.GetValue(1) != DBNull.Value)
                lastActivityDate = reader.GetDateTime(1);

            DateTime lastUpdatedDate = new DateTime();
            if (reader.GetValue(2) != DBNull.Value)
                lastUpdatedDate = reader.GetDateTime(2);

            bool isAnonymous = reader.GetBoolean(3);

            // ProfileInfo.Size not currently implemented.
            ProfileInfo p = new ProfileInfo(username,
                isAnonymous, lastActivityDate, lastUpdatedDate, 0);

            return p;
        }
开发者ID:grrizzly,项目名称:3D-Repository,代码行数:25,代码来源:MysqlProfileProvider.cs

示例8: CreateForm

        public static bool CreateForm(OdbcDataReader reader, Registration reg)
        {
            int fCount = reader.FieldCount;
            for (int i = 0; i < fCount; i++)
            {
                string name = reader.GetName(i);

                // Map to DB field. Need to change if db changed
                switch (name) {
                    case "regis_id": reg._regisID = reader.GetInt32(i);
                                      break;
                    case "transaction_id": reg._transactionID = reader.GetInt32(i);
                                      break;
                    case "transaction_code": reg._transactionCode = reader.GetString(i);
                                      break;
                    case "regis_date": reg._regisdate = new DateTime(reader.GetDateTime(i).Ticks);
                                      break;
                    case "student_id": reg._studentID = reader.GetInt32(i);
                                      break;
                    case "promotion_id": reg._promotionID = reader.GetInt32(i);
                                      break;
                    case "course_id": reg._courseID = reader.GetInt32(i);
                                      break;
                    case "branch_id": reg._branchID = reader.GetInt32(i);
                                      break;

                    case "full_cost": reg._fullCost = reader.GetInt32(i);
                                      break;
                    case "discounted_cost": reg._discountedCost = reader.GetInt32(i);
                                      break;
                    case "seat_no": reg._seatNo = reader.GetString(i);
                                      break;
                    case "note": reg._note = reader.GetString(i);
                                      break;
                    case "paid_method": reg._paidMethod = reader.GetInt32(i);
                                      break;
                    case "paid_round": reg._paidRound = reader.GetInt32(i);
                                      break;
                    case "paid_date": reg._paiddate = new DateTime(reader.GetDateTime(i).Ticks);
                                      break;
                    case "username": reg._username = reader.GetString(i);
                                      break;
                    case "status": reg._status = reader.GetInt32(i);
                                      break;
                    case "is_paid": reg._isPaid = reader.GetInt32(i) > 0 ? true : false;
                                      break;

                    // helper info
                    case "bts_course_id":
                                      reg._btsCourseID = reader.GetString(i);
                                      break;
                    case "student_firstname":
                                      reg._studentFirstname = reader.GetString(i);
                                      break;
                    case "student_surname":
                                      reg._studentSurname = reader.GetString(i);
                                      break;
                    case "student_school":
                                      reg._studentSchool = reader.GetString(i);
                                      break;
                    case "student_level":
                                      reg._studentLevel = reader.GetInt32(i);
                                      break;
                    case "course_name":
                                      reg._courseName = reader.GetString(i);
                                      break;
                    case "course_type":
                                      reg._courseType = reader.GetString(i);
                                      break;
                    case "course_category":
                                      reg._courseCategotry = reader.GetString(i);
                                      break;
                    case "start_date": reg._courseStart = new DateTime(reader.GetDateTime(i).Ticks);
                                      break;
                    case "end_date": reg._courseEnd = new DateTime(reader.GetDateTime(i).Ticks);
                                      break;

                    case "course_short_name":
                                      reg._courseShortName = reader.GetString(i);
                                      break;
                    case "branch_code":
                                      reg._branchCode = reader.GetString(i);
                                      break;

                }
            }
            return reader.HasRows;
        }
开发者ID:nettatata,项目名称:btsman,代码行数:88,代码来源:Registration.cs

示例9: CreateForm

        public static bool CreateForm(OdbcDataReader reader, PaymentHistory paymentHistory)
        {
            int fCount = reader.FieldCount;
            for (int i = 0; i < fCount; i++)
            {
                string name = reader.GetName(i);

                // Map to DB field. Need to change if db changed
                switch (name)
                {
                    case "payment_id": paymentHistory._paymentID = reader.GetInt32(i);
                        break;
                    case "course_id": paymentHistory._courseID = reader.GetInt32(i);
                        break;
                    case "paid_cost": paymentHistory._paidCost = reader.GetInt32(i);
                        break;
                    case "paid_date": paymentHistory._paidDate = new DateTime(reader.GetDateTime(i).Ticks);
                        break;
                    case "sum_all_cost": paymentHistory._sumAllCost = reader.GetInt32(i);
                        break;
                    case "sum_max_payable": paymentHistory._sumMaxPayable = reader.GetInt32(i);
                        break;
                    case "sum_paid_cost": paymentHistory._sumPaidCost = reader.GetInt32(i);
                        break;
                    case "cost_info": paymentHistory._costInfo = reader.GetString(i);
                        break;
                    case "paid_round": paymentHistory._paidRound = reader.GetInt32(i);
                        break;
                    case "receiver_teacher_id": paymentHistory._receiverTeacherID = reader.GetInt32(i);
                        break;
                    case "username": paymentHistory._username = reader.GetString(i);
                        break;
                    case "branch_id": paymentHistory._branchID = reader.GetInt32(i);
                        break;

                    // helper info
                }
            }
            return reader.HasRows;
        }
开发者ID:nettatata,项目名称:btsman,代码行数:40,代码来源:PaymentHistory.cs


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