快捷搜索:

[WM]在SQL CE 3.5上用SqlCeResultSet优化查询

本文内容来自MSDN,版权不归笔者所有,特此声明:

http://msdn.microsoft.com/en-us/library/dd938877.aspx

原先想翻译原文的,然则里面有很都低级内容,以是就把关键的部分抽掏出来.

1.插入1000条数据的机能对照

1)DataSet插入数据

private void menuItemDataSet_Click(object sender, EventArgs e)

{

Stopwatch sw = Stopwatch.StartNew();

Cursor.Current = Cursors.WaitCursor;

// Insert 1000 recordsthis.appDatabaseDataSet = new AppDatabaseDataSet();

for (int i = 0; i1000; i++)

{

appDatabaseDataSet.PerfTest.AddPerfTestRow

("Some test data", DateTime.Now);

}

// Insert into the database

this.perfTestTableAdapter.Update(appDatabaseDataSet);

// Refresh display

this.perfTestBindingSource.DataSource = this.appDatabaseDataSet;

this.perfTestBindingSource.DataMember = "PerfTest";

Cursor.Current = Cursors.Default;

MessageBox.Show(

"Elapsed ms: " + sw.ElapsedMilliseconds.ToString());

}

您可能还会对下面的文章感兴趣: