我用New-Object System.Data.DataTable创建了一个$dt,然后调用Oracle.DataAccess将表的值填充到$dt中。
一下是输入$dt后的内容。
TIMESTAMP : 2015/3/25 23:25:37
CARNUM : 809
DATANUM : 25994
NEWCARNUM : 0
NEWDATANUM : 0
现在我想将表中某一项的值赋给其他变量,如NEWDATANUM的值,请问需要如何操作。
我之前设想的是使用$dt.NEWDATANUM,但是得到的是空值。
PS :\> $dt.gettype()
IsPublic IsSerial Name BaseType
——– ——– —- ——–
True True DataTable System.ComponentModel.MarshalByValueComponent
PS :\> $dt | get-member
TypeName: System.Data.DataRow
Name MemberType Definition
—- ———- ———-
AcceptChanges Method System.Void AcceptChanges()
BeginEdit Method System.Void BeginEdit()
CancelEdit Method System.Void CancelEdit()
ClearErrors Method System.Void ClearErrors()
Delete Method System.Void Delete()
EndEdit Method System.Void EndEdit()
Equals Method bool Equals(System.Object obj)
GetChildRows Method System.Data.DataRow[] GetChildRows(string relationName), System.Data.DataRow…
GetColumnError Method string GetColumnError(int columnIndex), string GetColumnError(string columnN…
GetColumnsInError Method System.Data.DataColumn[] GetColumnsInError()
GetHashCode Method int GetHashCode()
GetParentRow Method System.Data.DataRow GetParentRow(string relationName), System.Data.DataRow G…
GetParentRows Method System.Data.DataRow[] GetParentRows(string relationName), System.Data.DataRo…
GetType Method type GetType()
HasVersion Method bool HasVersion(System.Data.DataRowVersion version)
IsNull Method bool IsNull(int columnIndex), bool IsNull(string columnName), bool IsNull(Sy…
RejectChanges Method System.Void RejectChanges()
SetAdded Method System.Void SetAdded()
SetColumnError Method System.Void SetColumnError(int columnIndex, string error), System.Void SetCo…
SetModified Method System.Void SetModified()
SetParentRow Method System.Void SetParentRow(System.Data.DataRow parentRow), System.Void SetPare…
ToString Method string ToString()
Item ParameterizedProperty System.Object Item(int columnIndex) {get;set;}, System.Object Item(string co…
CARNUM Property System.Decimal CARNUM {get;set;}
DATANUM Property System.Decimal DATANUM {get;set;}
NEWCARNUM Property System.Decimal NEWCARNUM {get;set;}
NEWDATANUM Property System.Decimal NEWDATANUM {get;set;}
TIMESTAMP Property System.DateTime TIMESTAMP {get;set;}