代码如下:private void Form1_Load(object sender, EventArgs e)
{ string cn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "//fridge.mdb" + ";Persist Security Info=True"; OleDbConnection cnn = new OleDbConnection(cn);
string mysel = "Select fridg_id as 分组编号,"+" fridge_Tem as 温度,"+" fridge_Time as 时间 From fridge";
OleDbCommand com = new OleDbCommand(mysel, cnn);
DataTable dt = new DataTable("fridge");
OleDbDataAdapter da = new OleDbDataAdapter(com);
da.SelectCommand = com;
OleDbCommandBuilder cb = new OleDbCommandBuilder(da);
da.Fill(dt);
this.dataGridView1.DataSource = dt;
}
{ string cn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "//fridge.mdb" + ";Persist Security Info=True"; OleDbConnection cnn = new OleDbConnection(cn);
string mysel = "Select fridg_id as 分组编号,"+" fridge_Tem as 温度,"+" fridge_Time as 时间 From fridge";
OleDbCommand com = new OleDbCommand(mysel, cnn);
DataTable dt = new DataTable("fridge");
OleDbDataAdapter da = new OleDbDataAdapter(com);
da.SelectCommand = com;
OleDbCommandBuilder cb = new OleDbCommandBuilder(da);
da.Fill(dt);
this.dataGridView1.DataSource = dt;
}
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 WindowsApplication31
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
} private void Form1_Load(object sender, EventArgs e)
{
string cn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "//fridge.mdb" + ";Persist Security Info=True"; OleDbConnection cnn = new OleDbConnection(cn);
string mysel = "Select fridg_id as 分组编号," + " fridge_Tem as 温度," + " fridge_Time as 时间 From fridge";
OleDbCommand com = new OleDbCommand(mysel, cnn);
DataTable dt = new DataTable("fridge");
OleDbDataAdapter da = new OleDbDataAdapter(com);
da.SelectCommand = com;
OleDbCommandBuilder cb = new OleDbCommandBuilder(da);
da.Fill(dt);
this.dataGridView1.DataSource = dt;
}
}
}
我这里没有提示错误信息啊,你在看看吧,把我的这段代码拷贝过去看