new table的名字字符串连接问题

konglord 2003-08-23 12:02:19
我想用一个循环建立不同的表 表的名字是temptable1,temptable2,temptable3.....
请问 DataTable temptable_______= new DataTable() 空格里应该怎么写啊?
谢谢指教。
...全文
25 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
cshchina 2003-08-23
  • 打赏
  • 举报
回复
不能用数组吗?
或者自己写个类
public class NamedDataTable{
DataTable table;
String name;
NamedDataTable(String name){
this.name = name;
table = new DataTable();
}
.....
}

for(int i=0;i<n;i++)
namedDataTable[i] = new NamedDataTable("temptable"+i);
20030514 2003-08-23
  • 打赏
  • 举报
回复
http://expert.csdn.net/Expert/topic/2179/2179369.xml?temp=.4154322
有时间看看,帮帮我。
konglord 2003-08-23
  • 打赏
  • 举报
回复
而且m 不可能引用两次的 会报错的D:\sdroot\Duoba\ui\OilReceiving\RailTankAssay.aspx.cs(197): A local variable named 'temp' is already defined in this scope
有人会吗?
konglord 2003-08-23
  • 打赏
  • 举报
回复
但是我要增加列时 m 就没有columns这个属性啊 系统只是把它当作string 怎么办啊?
雪狼1234567 2003-08-23
  • 打赏
  • 举报
回复
for(int i=1 to 10)
{
string m = temptable +i.tostring();
DataTable m = new dataTable()
}

110,535

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧