Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
224 views
in Technique[技术] by (71.8m points)

c# - 在C#2005中返回多个数据表(Return Multiple DataTable in C# 2005)

I have table1 and table2 in a class..

(我在一个类中有table1和table2。)

public DataTable sampletable (DataTable table1,DataTable table2)
{
     // How to return the two table(table1 and table2)
}

Advance thank you

(提前谢谢)

  ask by Sam Casil translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
public DataTable[] sampletable (DataTable table1,DataTable table2) 
{ 
    return new DataTable[] { table1, table2 };
} 

Use an array.

(使用数组。)

And to retrieve a particular table:

(并检索特定表:)

DataTable[] dtArray = sampletable (YourFirstDt, YourSecondDt);

DataTable table1 = dtArray[0];
DataTable table2 = dtArray[1];

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...