本文整理汇总了C#中IDataReader.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# IDataReader.Dispose方法的具体用法?C# IDataReader.Dispose怎么用?C# IDataReader.Dispose使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDataReader
的用法示例。
在下文中一共展示了IDataReader.Dispose方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OfflineDataReader
public OfflineDataReader(IDataReader reader)
{
schemaTable = reader.GetSchemaTable();
//build column index lookup
int j = 0;
foreach (DataRow dr in schemaTable.Rows)
{
columnLookup[dr["ColumnName"].ToString().ToLower(CultureInfo.InvariantCulture)] = j;
j++;
}
//copy data
while (reader.Read())
{
object[] fields = new object[schemaTable.Rows.Count];
for (int i = 0; i < fields.Length; i++)
{
fields[i] = reader.GetValue(i);
}
records.Add(fields);
}
reader.Close();
reader.Dispose();
MoveFirst();
}
示例2: InMemoryDataReader
/// <summary>
/// Creates an InMemoryDataReader from a <see cref="IDataReader" />
/// </summary>
/// <param name="reader">The <see cref="IDataReader" /> which holds the records from the Database.</param>
public InMemoryDataReader(IDataReader reader)
{
ArrayList resultList = new ArrayList();
try
{
_currentResultIndex = 0;
_currentRowIndex = 0;
resultList.Add( new InMemoryResultSet( reader, true ) );
while( reader.NextResult() )
{
resultList.Add( new InMemoryResultSet( reader, false ) );
}
_results = ( InMemoryResultSet[ ] ) resultList.ToArray( typeof( InMemoryResultSet ) );
}
catch( Exception e )
{
throw new DataMapperException( "There was a problem converting an IDataReader to an InMemoryDataReader", e );
}
finally
{
reader.Close();
reader.Dispose();
}
}
示例3: CloseDataReader
internal static void CloseDataReader(IDataReader rd)
{
if (rd == null) return;
if (rd.IsClosed) return;
rd.Close();
rd.Dispose();
LogManager.GetLogger("Class:System.ORM.OrmHelper Method:CloseDataReader").Info("DataReader连接已关闭");
}
示例4: closeDataReader
public static void closeDataReader(IDataReader dr)
{
if (null != dr)
{
if (!dr.IsClosed)
{
dr.Close();
}
dr.Dispose();
}
}
示例5: GenerateOrganization_mstObject
public object GenerateOrganization_mstObject(ref IDataReader returnData)
{
Organization_mst obj = new Organization_mst();
while (returnData.Read())
{
DateTime Mydatetime = new DateTime();
obj.Orgid = (int)returnData["Orgid"];
obj.Orgname = (string)returnData["Orgname"];
obj.Description = (string)returnData["Description"];
Mydatetime = (DateTime)returnData["Createdatetime"];
obj.Createdatetime = Mydatetime.ToString();
}
returnData.Close();
returnData.Dispose();
return obj;
}
开发者ID:progressiveinfotech,项目名称:PRO_FY13_40_Helpdesk-Support-and-Customization_EIHAutoMail,代码行数:17,代码来源:SqlDataProvider.cs
示例6: GenerateOrganization_mstCollection
public CollectionBase GenerateOrganization_mstCollection(ref IDataReader returnData)
{
BLLCollection<Organization_mst> col = new BLLCollection<Organization_mst>();
while (returnData.Read())
{
DateTime Mydatetime = new DateTime();
Organization_mst obj = new Organization_mst();
obj.Orgid = (int)returnData["Orgid"];
obj.Orgname = (string)returnData["Orgname"];
obj.Description = (string)returnData["Description"];
Mydatetime = (DateTime)returnData["Createdatetime"];
obj.Createdatetime = Mydatetime.ToString();
col.Add(obj);
}
returnData.Close();
returnData.Dispose();
return col;
}
开发者ID:progressiveinfotech,项目名称:PRO_FY13_40_Helpdesk-Support-and-Customization_EIHAutoMail,代码行数:19,代码来源:SqlDataProvider.cs
示例7: DataReaderResult
/// <summary>
/// Initializes a new instance of the <see cref="DataReaderResult"/> class.
/// </summary>
public DataReaderResult(IDataReader reader)
{
try
{
_data = ReadAll(reader).ToArray();
_schema = new DataReaderField[reader.FieldCount];
for (int i = 0; i < reader.FieldCount; i++)
{
_schema[i] = new DataReaderField(reader.GetName(i), reader.GetFieldType(i),
reader.GetDataTypeName(i));
}
}
finally
{
reader.Close();
reader.Dispose();
}
}
示例8: DisconnectedReader
/// <summary>
/// Caches a data reader to enable disconnected data access via the IDataReader interface.
/// </summary>
/// <param name="reader">The IDataReader to cache.</param>
public DisconnectedReader(IDataReader reader)
{
// Cache field information
this.fields = new FieldInfo[reader.FieldCount];
this.ordinals = new Hashtable(StringComparer.OrdinalIgnoreCase);
for (int index = 0; index < fields.Length; index++)
{
FieldInfo field = new FieldInfo();
field.Name = reader.GetName(index);
field.Type = reader.GetFieldType(index);
field.DataTypeName = reader.GetDataTypeName(index);
fields[index] = field;
if (!ordinals.Contains(field.Name))
ordinals.Add(field.Name, index);
}
// Cache schema info
schema = reader.GetSchemaTable();
// Cache row data
rows = new ArrayList();
while (reader.Read())
{
object[] values = new object[fields.Length];
reader.GetValues(values);
rows.Add(values);
}
// Cache additional results
if (reader.NextResult())
nextResult = new DisconnectedReader(reader);
// Close the reader once all data has been cached
else
reader.Dispose();
// Set the record index before the first record;
this.recordIndex = -1;
this.lastIndex = rows.Count - 1;
}
示例9: SetDataGridViewData
/// <summary>
/// Sets the data in DataGridView from the DbDataReader object.
/// The columns can be filtered or null to get all columns from the data reader in the the data grid view.
///
/// Notes:
/// 1. There's no data binding going on
/// 2. The data reader object is disposed
/// </summary>
/// <param name="dataGridView"></param>
/// <param name="dataReader"></param>
/// <param name="columnFilter">The columns to filter.</param>
/// <param name="filterType">Whether to keep the items in the filter (remove all others) or remove them (keep all others).</param>
public static void SetDataGridViewData(DataGridView dataGridView, IDataReader dataReader, IEnumerable<string> columnFilter, Util.FilterType filterType)
{
// Convert data reader into data table
DataTable dataTable = new DataTable();
dataTable.Load(dataReader);
dataReader.Close();
dataReader.Dispose();
SetDataGridViewData(dataGridView, dataTable, columnFilter, filterType);
}
示例10: GenerateViewServiceWindow_mstCollection
public CollectionBase GenerateViewServiceWindow_mstCollection(ref IDataReader returnData)
{
BLLCollection<ServiceWindow_mst> col = new BLLCollection<ServiceWindow_mst>();
while (returnData.Read())
{
ServiceWindow_mst obj = new ServiceWindow_mst();
obj.Servicewindowid = (int)returnData["Servicewindowid"];
obj.Siteid = (int)returnData["Siteid"];
col.Add(obj);
}
returnData.Close();
returnData.Dispose();
return col;
}
开发者ID:progressiveinfotech,项目名称:PRO_FY13_40_Helpdesk-Support-and-Customization_EIH,代码行数:15,代码来源:SqlDataProvider.cs
示例11: GenerateTechnician_To_GroupObject
public object GenerateTechnician_To_GroupObject(ref IDataReader returnData)
{
Technician_To_Group obj = new Technician_To_Group();
while (returnData.Read())
{
obj.Groupid = (int)returnData["Groupid"];
obj.Technicianid = (int)returnData["Technicianid"];
}
returnData.Close();
returnData.Dispose();
return obj;
}
开发者ID:progressiveinfotech,项目名称:PRO_FY13_40_Helpdesk-Support-and-Customization_EIH,代码行数:13,代码来源:SqlDataProvider.cs
示例12: GenerateVendor_mstCollection
public CollectionBase GenerateVendor_mstCollection(ref IDataReader returnData)
{
BLLCollection<Vendor_mst> col = new BLLCollection<Vendor_mst>();
while (returnData.Read())
{
Vendor_mst obj = new Vendor_mst();
obj.Vendorid = (int)returnData["vendorid"];
obj.Vendorname = (string)returnData["vendorname"];
obj.Contactperson = (string)returnData["contactperson"];
col.Add(obj);
}
returnData.Close();
returnData.Dispose();
return col;
}
开发者ID:progressiveinfotech,项目名称:PRO_FY13_40_Helpdesk-Support-and-Customization_EIH,代码行数:16,代码来源:SqlDataProvider.cs
示例13: GenerateVendor_mstObject
public object GenerateVendor_mstObject(ref IDataReader returnData)
{
Vendor_mst obj = new Vendor_mst();
while (returnData.Read())
{
obj.Contactperson = (string)returnData["Contactperson"];
obj.Vendorid = (int)returnData["Vendorid"];
obj.Vendorname = (string)returnData["Vendorname"];
}
returnData.Close();
returnData.Dispose();
return obj;
}
开发者ID:progressiveinfotech,项目名称:PRO_FY13_40_Helpdesk-Support-and-Customization_EIH,代码行数:14,代码来源:SqlDataProvider.cs
示例14: GenerateUserLogin_mstCollection
public CollectionBase GenerateUserLogin_mstCollection(ref IDataReader returnData)
{
BLLCollection<UserLogin_mst> col = new BLLCollection<UserLogin_mst>();
while (returnData.Read())
{
UserLogin_mst obj = new UserLogin_mst();
obj.Userid = (int)returnData["Userid"];
obj.Username = (string)returnData["Username"];
obj.Roleid = (int)returnData["Roleid"];
obj.Password = (string)returnData["Password"];
obj.Orgid = (int)returnData["Orgid"];
obj.Enable = (bool)returnData["Enable"];
if (returnData["DomainName"] != DBNull.Value)
{
obj.DomainName = (string)returnData["DomainName"];
}
//obj.Company = (string)returnData["Company"];
//obj.City = (string)returnData["City"];
obj.ADEnable = (bool)returnData["ADEnable"];
DateTime Mydatetime = new DateTime();
Mydatetime = (DateTime)returnData["Createdatetime"];
obj.Createdatetime = Mydatetime.ToString();
col.Add(obj);
}
returnData.Close();
returnData.Dispose();
return col;
}
开发者ID:progressiveinfotech,项目名称:PRO_FY13_40_Helpdesk-Support-and-Customization_EIH,代码行数:28,代码来源:SqlDataProvider.cs
示例15: GenerateUser_mstObject
public object GenerateUser_mstObject(ref IDataReader returnData)
{
UserLogin_mst obj = new UserLogin_mst();
while (returnData.Read())
{
obj.Password = (string)returnData["Password"];
obj.Userid = (int)returnData["userid"];
obj.Username = (string)returnData["username"];
obj.Roleid = (int)returnData["Roleid"];
obj.Orgid = (int)returnData["Orgid"];
obj.Enable = (bool)returnData["Enable"];
obj.ADEnable = (bool)returnData["ADEnable"];
if (returnData["Company"] != DBNull.Value)
{
obj.Company = (string)returnData["Company"];
}
if (returnData["City"] != DBNull.Value)
{
obj.City = (string)returnData["City"];
}
}
returnData.Close();
returnData.Dispose();
return obj;
}
开发者ID:progressiveinfotech,项目名称:PRO_FY13_40_Helpdesk-Support-and-Customization_EIH,代码行数:25,代码来源:SqlDataProvider.cs