本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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"));
}
示例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));
}
}
示例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);
}
示例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()));
}
示例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");
}
示例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"));
}
示例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));
}
}
示例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");
}
}
示例13: GetUnoSQlValue
public object GetUnoSQlValue(SqlDataReader rdb, string str)
{
if (rdb.IsDBNull(rdb.GetOrdinal(str)))
{
return null;
}
else
{
return rdb[(rdb.GetOrdinal(str))];
}
}
示例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")
)
};
}
示例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;
}