字符名称转化为变量?
For i= 1 to nRowAddDataTable.Getsheet("add").SetCurrentRow(i)
ClickDep=DataTable.Value("ClickDep","add")
OrgId=DataTable.Value("OrgId","add")
OrgName=DataTable.Value("OrgName","add")
OrgParId=DataTable.Value("OrgParId","add")
IfEnable=DataTable.Value("IfEnable","add")
Ifjc=DataTable.Value("Ifjc","add")
Resumer=DataTable.Value("Resumer","add")
Telephone=DataTable.Value("Telephone","add")
Memo=DataTable.Value("Memo","add")
ExpectedResults=DataTable.Value("ExpectedResults","add")
Next
-------------------------------------
我想写个函数可以将 datatable的列名转化为变量,并将值赋给这个变量,但是不行,应该怎么写啊?
Function InitDataTable(sheetName,nRowAdd,nColumnAdd)
For i= 1 to nRowAdd
For j=1 to nColumnAdd
DataTable.Getsheet(sheetName).SetCurrentRow(i)
ColumnName=DataTable.GetSheet(sheetName).GetParameter(j).Name
Execute ColumnName & "=DataTable.Value(" & """ & ColumnName & """ & "," & """ & sheetName & """ & ")"
Next
Next
End Function 你是想这样做么?
ColumnName = DataTable.Value(ColumnName , sheetName ) 原帖由 hsjzfling 于 2010-2-5 23:07 发表 http://bbs.51testing.com/images/common/back.gif
你是想这样做么?
ColumnName = DataTable.Value(ColumnName , sheetName )
刚才运行了,这样是不行的,你运行试试:) 我只是问你是不是要这么做……达到这个目的可以试下以下代码,就是拼接下字符串么
Execute ColumnName &" = DataTable.Value(ColumnName , sheetName )" 路过,学习了 哇塞,可以了也,太感谢了,呵呵
页:
[1]