我想用这段代码将我的数据表的数据放在我的 datagridview 中。
Tbl_events.DataSource = datatabel.DefaultView;
这需要很多时间。有没有更快的解决方案
完整代码
connection.Open();
//datatabel.Load(new SqlCommand("SELECT type,datum,uur,controller,fout,teller,omschrijving,graad,var1,var2,var3,var4,var5,var6,var7,var8,var9,var10,var11,var12,var13,var14,var15,var16,var17,var18,var19,var20,var21,var22,var23,var24,var25,var26,var27,var28,var29,var30,var31,var32,var33,var34,var35,Cat_MMAP FROM " + tabelnaam + " where " + filter + "", connection).ExecuteReader());
Tbl_events.DataSource=(new SqlCommand("SELECT type,datum,uur,controller,fout,teller,omschrijving,graad,var1,var2,var3,var4,var5,var6,var7,var8,var9,var10,var11,var12,var13,var14,var15,var16,var17,var18,var19,var20,var21,var22,var23,var24,var25,var26,var27,var28,var29,var30,var31,var32,var33,var34,var35,Cat_MMAP FROM " + tabelnaam + " where " + filter + "", connection).ExecuteReader());
connection.Close();
jaartaltabel++;
}
catch
{
jaartaltabel++;
aantalfouten++;
connection.Close();
}
}
//Tbl_events.DataSource = datatabel.DefaultView;
// ColumnWidth();
statusbalk.Increment(20);
}
rijsql = 0;
我尝试将 sql 中的数据放在 datagridview.datasource 中,但这不起作用。它不是需要大量时间的 sql 查询,而是这段代码:Tbl_events.DataSource = datatabel.DefaultView;