今天偶尔有个东西要用到维数组发现不会搞来搞去搞了半天还是上网google了资料
总结一下
定义变量的方法
private string[] ColumnsList = {
序号|rowid主帐户|masteraccount主帐号|childaccount卡号|cardno
户名|name客户号|crmid科目号|stocktype
原金额|orgincount发生额|currcount新金额|newcount状态|state
};
private string[] dataList = {
{张三风正常}
{张三风正常}
{张三风挂失}
{张三风注销}
};
遍历添加到Table中
DataTable dt = new DataTable();
for(int i=;i<ColumnsListLength;i++)
{
string[] templist = ColumnsList[i]Split(|);
if (templistLength != ) continue;
dtColumnsAdd(templist[]Trim() typeof(string));
}
dtAcceptChanges();
for (int i = ; i < ; i++)
{
DataRow dr = dtNewRow();
for(int j=;j<ColumnsListLength;j++)
{
string[] templist = ColumnsList[j]Split(|);
if (templistLength != ) continue;
dr[templist[]Trim()] = dataList[i j]Trim();
}
dtRowsAdd(dr);
}
dtAcceptChanges();
记一下防止以后忘记!