日期:2014-05-18 浏览次数:21057 次
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.Data.OleDb; namespace WindowsApplication4 { public partial class Form1 : Form { OleDbDataAdapter da; DataTable dt; OleDbConnection cn; public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { da.Update(dt); } private void Form1_Load(object sender, EventArgs e) { cn = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=F:\Northwind.mdb"); da = new OleDbDataAdapter("select * from orders", cn); OleDbCommandBuilder cb = new OleDbCommandBuilder(da); dt = new DataTable(); da.Fill(dt); dataGridView1.DataSource = dt; } } }