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


C# SqlDataReader.GetOrdinal方法代码示例

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


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

示例1: ValidateDataReader_T

 public static DateTime ValidateDataReader_T(SqlDataReader reader,string colname)
 {
     if(reader.GetValue(reader.GetOrdinal(colname))!=DBNull.Value)
         return reader.GetDateTime(reader.GetOrdinal(colname));
     else
         return System.DateTime.MinValue;
 }
开发者ID:JohnToCoder,项目名称:MyBookShop_1,代码行数:7,代码来源:GetSafeData.cs

示例2: ValidateDataReader_N

 public static int ValidateDataReader_N(SqlDataReader reader,string colname)
 {
     if(reader.GetValue(reader.GetOrdinal(colname))!=DBNull.Value)
         return reader.GetInt32(reader.GetOrdinal(colname));
     else
         return System.Int32.MinValue;
 }
开发者ID:JohnToCoder,项目名称:MyBookShop_1,代码行数:7,代码来源:GetSafeData.cs

示例3: ValidateDataReader_S

 /// <summary>
 /// ��SqlDataReader�а�ȫ��ȡ����
 /// </summary>
 /// <param name="reader">���ݶ�ȡ��SqlDataReader</param>
 /// <param name="colname">����</param>
 /// <returns>���е��ַ������ݣ����Ϊ�գ��򷵻�System.String.Empty</returns>
 public static string ValidateDataReader_S(SqlDataReader reader,string colname)
 {
     if(reader.GetValue(reader.GetOrdinal(colname))!=DBNull.Value)
         return reader.GetString(reader.GetOrdinal(colname));
     else
         return System.String.Empty;
 }
开发者ID:JohnToCoder,项目名称:MyBookShop_1,代码行数:13,代码来源:GetSafeData.cs

示例4: Map

        public static Request Map(SqlDataReader record)
        {
            if (record == null) throw new ArgumentNullException("record");
            var request = new Request();

            request.Id = (int) record["Id"];
            request.RequesTime = (DateTime) record["RequetTime"];
            if (record["CreatorId"].ToString() != string.Empty)
            {
                request.CreatorId = (int) record["CreatorId"];
            }
            request.PhoneNumber = (string) record["PhoneNumber"];
            request.Status = (int) record["Status"];
            request.StartPoint = (string) record["StartPoint"];
            request.FinishPoint = (string) record["FinishPoint"];
            request.OperatorId = record.IsDBNull(record.GetOrdinal("OperatorId")) == false
                              ? (int)record["OperatorId"]
                              : default(int?);
            request.DriverId = record.IsDBNull(record.GetOrdinal("DriverId")) == false
                ? (int?) record["DriverId"]
                : default(int?);
            request.Price = record.IsDBNull(record.GetOrdinal("Price")) == false
               ? (decimal?)record["Price"]
               : default(decimal?);
            request.Additional = record.IsDBNull(record.GetOrdinal("Additional")) == false
               ? (string)record["Additional"]
               : default(string);
            return request;
        }
开发者ID:poliko6,项目名称:taksopark,代码行数:29,代码来源:RequestMapper.cs

示例5: Map

 public override void Map(SqlDataReader sqlDataReader)
 {
     this.Id = sqlDataReader.GetGuid(sqlDataReader.GetOrdinal("Id"));
     this.Name = sqlDataReader.GetString(sqlDataReader.GetOrdinal("Name"));
     this.Level = sqlDataReader.GetByte(sqlDataReader.GetOrdinal("Level"));
     this.CountryId = sqlDataReader.GetGuid(sqlDataReader.GetOrdinal("CountryId"));
 }
开发者ID:mchound,项目名称:falyze,代码行数:7,代码来源:League.cs

示例6: PopulateVolunteer

 public void PopulateVolunteer(SqlDataReader _dtr, Volunteer obj)
 {
     int columnIndex = 0;
     columnIndex = _dtr.GetOrdinal(VolunteerDataMapper.CN_ID);
     if (!_dtr.IsDBNull(columnIndex))
     {
         obj.ID = _dtr.GetInt32((columnIndex));
     }
     columnIndex = _dtr.GetOrdinal(VolunteerDataMapper.CN_NAME);
     if (!_dtr.IsDBNull(columnIndex))
     {
         obj.Name = _dtr.GetString((columnIndex));
     }
     columnIndex = _dtr.GetOrdinal(VolunteerDataMapper.CN_EMAIL);
     if (!_dtr.IsDBNull(columnIndex))
     {
         obj.Email = _dtr.GetString((columnIndex));
     }
     columnIndex = _dtr.GetOrdinal(VolunteerDataMapper.CN_CV);
     if (!_dtr.IsDBNull(columnIndex))
     {
         obj.CV = _dtr.GetString((columnIndex));
     }
     columnIndex = _dtr.GetOrdinal(VolunteerDataMapper.CN_MESSAGE);
     if (!_dtr.IsDBNull(columnIndex))
     {
         obj.Message = _dtr.GetString((columnIndex));
     }
 }
开发者ID:yalhami,项目名称:eXpresso,代码行数:29,代码来源:DataMapperBase.cs

示例7: Tarjeta

 public Tarjeta(SqlDataReader reader)
 {
     this.codTarjeta = reader.IsDBNull(reader.GetOrdinal("codTarjeta")) ? null : (string)reader["codTarjeta"];
     this.fecEmision = reader.IsDBNull(reader.GetOrdinal("fechaEmi")) ? null : (string)reader["fechaEmi"].ToString();
     this.fecAnulado = reader.IsDBNull(reader.GetOrdinal("fechaAnu")) ? null : (string)reader["fechaAnu"].ToString();
     this.estado = reader.IsDBNull(reader.GetOrdinal("estado")) ? -1 : (int)reader["estado"];
     this.cliente = new Cliente(reader);
 }
开发者ID:alfonsobp,项目名称:made-in-house,代码行数:8,代码来源:Tarjeta.cs

示例8: DeserializeQueuedEvent

 private object DeserializeQueuedEvent(SqlDataReader result)
 {
     var eventTypeIdColumnId = result.GetOrdinal("EventTypeId");
     var eventDataColumnId = result.GetOrdinal("EventData");
     result.Read();
     var eventTypeId = result.GetSqlGuid(eventTypeIdColumnId).Value;
     return this.serializationMethod.Deserialize(new XmlSerializedData(eventTypeId, result.GetSqlXml(eventDataColumnId).CreateReader()));
 }
开发者ID:TheSoftweyrGroup,项目名称:Softweyr.EventStore,代码行数:8,代码来源:SqlServer2008PersistenceSession.cs

示例9: PopulateOrdinals

 public void PopulateOrdinals(SqlDataReader reader)
 {
     ord_CustomerID = reader.GetOrdinal("CustomerID");
     ord_FirstName = reader.GetOrdinal("FirstName");
     ord_LastName = reader.GetOrdinal("LastName");
     ord_Age = reader.GetOrdinal("Age");
     ord_EmailAddress = reader.GetOrdinal("EmailAddress");
 }
开发者ID:sudiparora,项目名称:AASolFW,代码行数:8,代码来源:CustomerParser.cs

示例10: LoginDB

        public LoginDB(System.Data.SqlClient.SqlDataReader reader)
        {
            this.reader = reader;
            this.ID = reader.GetInt64(reader.GetOrdinal("Id"));
            this.Login = reader.GetString(reader.GetOrdinal("Login"));
            this.Senha = reader.GetString(reader.GetOrdinal("Senha"));

        }
开发者ID:rogeriofabricio,项目名称:XamarinCursoCross,代码行数:8,代码来源:Login.cs

示例11: PopulateCategory

        public void PopulateCategory(SqlDataReader _dtr, Category obj)
        {
            int columnIndex = 0;
            columnIndex = _dtr.GetOrdinal(CategoryDataMapper.CN_ID);
            if (!_dtr.IsDBNull(columnIndex))
            {
                obj.ID = _dtr.GetInt32((columnIndex));
            }
            columnIndex = _dtr.GetOrdinal(CategoryDataMapper.CN_NAME);
            if (!_dtr.IsDBNull(columnIndex))
            {
                obj.Name = _dtr.GetString((columnIndex));
            }
            columnIndex = _dtr.GetOrdinal(CategoryDataMapper.CN_DESCRIPTION);
            if (!_dtr.IsDBNull(columnIndex))
            {
                obj.Description = _dtr.GetString((columnIndex));
            }
            columnIndex = _dtr.GetOrdinal(CategoryDataMapper.CN_TYPE);
            if (!_dtr.IsDBNull(columnIndex))
            {
                obj.Type = (TG.ExpressCMS.DataLayer.Enums.RootEnums.CategoryType)_dtr.GetInt32((columnIndex));
            }
            columnIndex = _dtr.GetOrdinal(CategoryDataMapper.CN_ATTRIBUTES);
            if (!_dtr.IsDBNull(columnIndex))
            {
                obj.Attributes = _dtr.GetString((columnIndex));
            }
            columnIndex = _dtr.GetOrdinal(CategoryDataMapper.CN_ISDELETED);
            if (!_dtr.IsDBNull(columnIndex))
            {
                obj.IsDeleted = _dtr.GetBoolean((columnIndex));
            }
            columnIndex = _dtr.GetOrdinal(CategoryDataMapper.CN_XSL_ID);
            if (!_dtr.IsDBNull(columnIndex))
            {
                obj.XslID = _dtr.GetInt32((columnIndex));
            }
            columnIndex = _dtr.GetOrdinal(CategoryDataMapper.CN_image);
            if (!_dtr.IsDBNull(columnIndex))
            {
                obj.Image = _dtr.GetString((columnIndex));
            }

            columnIndex = _dtr.GetOrdinal(CategoryDataMapper.CN_LANGUAGE_ID);
            if (!_dtr.IsDBNull(columnIndex))
            {
                obj.LanguageID = _dtr.GetInt32((columnIndex));
            }

            columnIndex = _dtr.GetOrdinal(CategoryDataMapper.CN_HASH);
            if (!_dtr.IsDBNull(columnIndex))
            {
                obj.Hash = _dtr.GetString((columnIndex));
            }
        }
开发者ID:yalhami,项目名称:eXpresso,代码行数:56,代码来源:DataMapperBase.cs

示例12: InitIndex

 private static void InitIndex(SqlDataReader reader)
 {
     if (NameIndex == -1)
     {
         object_idIndex = reader.GetOrdinal("object_id");
         NameIndex = reader.GetOrdinal("Name");
         ownerIndex = reader.GetOrdinal("owner");
         typeIndex = reader.GetOrdinal("type");
     }
 }
开发者ID:elayaraja007,项目名称:sql-dbdiff,代码行数:10,代码来源:GenerateStoreProcedures.cs

示例13: GetUnoSQlValue

 public object GetUnoSQlValue(SqlDataReader rdb, string str)
 {
     if (rdb.IsDBNull(rdb.GetOrdinal(str)))
     {
         return null;
     }
     else
     {
         return rdb[(rdb.GetOrdinal(str))];
     }
 }
开发者ID:kirill18,项目名称:AppEvent,代码行数:11,代码来源:RepositoryDiscriptionEvent.cs

示例14: CreateNotification

 private Notification CreateNotification(SqlDataReader reader)
 {
     return new Notification
     {
         ID = reader.GetGuid(reader.GetOrdinal("NotificationID")),
         LanguageCode = GetString(reader, "LanguageCode"),
         Subject = GetString(reader, "Subject"),
         TypeKey = GetString(reader, "TypeKey"),
         Dispatched = reader.GetBoolean(reader.GetOrdinal("Dispatched")),
         Parameter = new JavaScriptSerializer().Deserialize<Dictionary<string, string>>(
             GetString(reader, "Parameter")
         )
     };
 }
开发者ID:jbinder,项目名称:dragon,代码行数:14,代码来源:SqlNotificationStore.cs

示例15: Resolve

        public IProject Resolve(IProject project, SqlDataReader reader)
        {
            project.ProjectId = Convert.ToInt32(reader["projectId"]);
            project.Name = Convert.ToString(reader["name"]);
            project.StatusId = Convert.ToInt32(reader["statusId"]);

            if(!reader.IsDBNull(reader.GetOrdinal("PlannedEndDate"))) project.PlannedEndDate = Convert.ToDateTime(reader["PlannedEndDate"]);
            if (!reader.IsDBNull(reader.GetOrdinal("ActualEndDate"))) project.ActualEndDate = Convert.ToDateTime(reader["ActualEndDate"]);
            if (!reader.IsDBNull(reader.GetOrdinal("PlannedStartDate"))) project.PlannedStartDate = Convert.ToDateTime(reader["PlannedStartDate"]);
            if (!reader.IsDBNull(reader.GetOrdinal("ActualStartDate"))) project.ActualEndDate = Convert.ToDateTime(reader["ActualStartDate"]);

               project.CompanyId = Convert.ToInt32(reader["companyId"]);

            return project;
        }
开发者ID:solutiatonyspears,项目名称:TrainingProjectReference,代码行数:15,代码来源:ProjectAdapter.cs


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