我们需要更多的帮助来帮助您。我们不知道您的数据源是什么样的、表结构和其他重要细节。
我刚刚针对我的一个数据库做了一个快速示例,结果看起来有点不同。
$SqlConnection = new-object System.Data.SqlClient.SqlConnection
$SqlConnection.ConnectionString = "data source=.;Initial catalog=db;Trusted_Connection=True;"
$SqlCommand = $SqlConnection.CreateCommand()
$SqlCommand.CommandText = "SELECT * FROM dbo.Table"
$DataAdapter = new-object System.Data.SqlClient.SqlDataAdapter $SqlCommand
$dataset = new-object System.Data.Dataset
$DataAdapter.Fill($dataset)
你的类型说:“Deserialized.System.Data.DataRow”,而我的类型说“System.Data.DataRow”。
PS C:\windows\system32> $dataset.Tables[0] | Get-Member
TypeName: System.Data.DataRow
Name MemberType Definition
---- ---------- ----------
AcceptChanges Method void AcceptChanges()
BeginEdit Method void BeginEdit()
CancelEdit Method void CancelEdit()
ClearErrors Method void ClearErrors()
Delete Method void Delete()
EndEdit Method void EndEdit()
Equals Method bool Equals(System.Object obj)
GetChildRows Method System.Data.DataRow[] GetChildRows(string relationName), System.Data...
GetColumnError Method string GetColumnError(int columnIndex), string GetColumnError(string...
GetColumnsInError Method System.Data.DataColumn[] GetColumnsInError()
GetHashCode Method int GetHashCode()
GetParentRow Method System.Data.DataRow GetParentRow(string relationName), System.Data.D...
GetParentRows Method System.Data.DataRow[] GetParentRows(string relationName), System.Dat...
GetType Method type GetType()
HasVersion Method bool HasVersion(System.Data.DataRowVersion version)
IsNull Method bool IsNull(int columnIndex), bool IsNull(string columnName), bool I...
RejectChanges Method void RejectChanges()
SetAdded Method void SetAdded()
SetColumnError Method void SetColumnError(int columnIndex, string error), void SetColumnEr...
SetModified Method void SetModified()
SetParentRow Method void SetParentRow(System.Data.DataRow parentRow), void SetParentRow(...
ToString Method string ToString()
Item ParameterizedProperty System.Object Item(int columnIndex) {get;set;}, System.Object Item(s...
ACCOUNTTYPE Property int ACCOUNTTYPE {get;set;}
AUTOINFO Property int AUTOINFO {get;set;}
AUTOLOGOFF Property int AUTOLOGOFF {get;set;}
AUTOUPDATE Property int AUTOUPDATE {get;set;}
CLIENTACCESSLOGLEVEL Property int CLIENTACCESSLOGLEVEL {get;set;}
COMPANY Property string COMPANY {get;set;}
COMPILERWARNINGLEVEL Property int COMPILERWARNINGLEVEL {get;set;}
CONFIRMDELETE Property int CONFIRMDELETE {get;set;}
CONFIRMUPDATE Property int CONFIRMUPDATE {get;set;}
CREDENTIALRECID Property long CREDENTIALRECID {get;set;}
DEBUGGERPOPUP Property int DEBUGGERPOPUP {get;set;}
... ... ...
所以我可用的方法列表超出了您的列表。那是第一次。接下来是我的所有属性都映射到表中的一列。
所以我猜你需要分享更多关于如何将数据填充到数据集对象的代码,以便我们了解你面临的问题。