如何将c1FlexGrid实现整表保存
http://gcdn.gcpowertools.com.cn/forum.php?mod=viewthread&tid=10873&highlight=flexgrid%2B%B1%A3%B4%E6
下载了这个贴子的源码?
代码如下:
void Form1_Load(object sender, System.EventArgs e)
{
this.oleDbDataAdapterCustomers.Fill(this.dataSet11);
this.oleDbDataAdapterSuppliers.Fill(this.dataSet11);
}
void button1_Click(object sender, System.EventArgs e)
{
int n = this.oleDbDataAdapterCustomers.Update(this.dataSet11.Customers);
Console.WriteLine("{0} records updated", n);
}
void button2_Click(object sender, System.EventArgs e)
{
int n = this.oleDbDataAdapterSuppliers.Update(this.dataSet11.Suppliers);
Console.WriteLine("{0} records updated", n);
}
void _flex_OwnerDrawCell(object sender, C1.Win.C1FlexGrid.OwnerDrawCellEventArgs e)
{
C1.Win.C1FlexGrid.C1FlexGrid fg = sender as C1.Win.C1FlexGrid.C1FlexGrid;
if (e.Col >= fg.Cols.Fixed)
{
int index = fg.Rows[e.Row].DataIndex;
if (index >= 0)
{
DataTable dt = fg.DataSource as DataTable;
DataView dv = dt.DefaultView;
if (dv[index].Row.RowState == DataRowState.Modified)
e.Style = fg.Styles["Modified"];
//这一段是什么意思?
}
}
}
static string GetConnectionString()
{
string path = Environment.GetFolderPath(Environment.SpecialFolder.Personal) + @"\ComponentOne Samples\Common";
string conn = @"provider=microsoft.jet.oledb.4.0;data source={0}\c1nwind.mdb;";
return string.Format(conn, path);
}
|