C#数据库处理时遇到问题
using System;using System.Collections.Generic;
using
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;
namespace 表格处理
{
public partial class Form1 : Form
{
OleDbConnection conn = new OleDbConnection();
OleDbCommand comm = new OleDbCommand();
OleDbDataAdapter adapter = new OleDbDataAdapter();
DataSet ds = new DataSet();
public Form1()
{
InitializeComponent();
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=studentinfo.mdb";
conn.Open();
comm.Connection = conn;
= "select * from studentinfo where '分数'>75";
adapter.SelectCommand = comm;
OleDbCommandBuilder builder = new OleDbCommandBuilder(adapter);
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
ds.Clear();
adapter.Fill(ds, "good");
d1.DataSource = ds.Tables["good"];
}
private void button2_Click(object sender, EventArgs e)
{
adapter.Update(ds, "good");
}
}
}
注:在adapter.Fill(ds,"good")这儿提示 :标准表达式中数据类型不匹配。