下面这段代码在2003中需要157秒,在2005中只要11秒就可以完成:
DataSet ds = new DataSet();
ds.Tables.Add("BigTable");
ds.Tables[0].Columns.Add("ID", Type.GetType("System.Int32"));
ds.Tables[0].Columns["ID"].Unique = true;
ds.Tables[0].Columns.Add("Value", Type.GetType("System.Int32"));
Cursor.Current = Cursors.WaitCursor;
DateTime datBegin = DateTime.Now;
Random rand = new Random();
int i, intValue;
DataRow dr;
for (i = 1; i <= 500000; i++)
{
try
{
intValue = rand.Next();
dr = ds.Tables[0].NewRow();
dr["ID"] = intValue;
dr["Value"] = intValue;
ds.Tables[0].Rows.Add(dr);
}
catch { }
本新闻共4页,当前在第1页 1 2 3 4
