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.ACE.OLEDB.12.0;Data Source=studentinfo.mdb";
conn.Open();
comm.Connection = conn;
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
string strcomm;
if (r1.Checked)
strcomm = "select * from studentinfo where no= t1.Text";
else if (r2.Checked)
strcomm = "select * from studentinfo where name=t1.Text";
else
strcomm = "select * from studentinfo where score >t1.Text ";
= strcomm;
adapter.SelectCommand = comm;
OleDbCommandBuilder builder = new OleDbCommandBuilder(adapter);
ds.Clear();
adapter.Fill(ds,"good"); 此处提示说:至少一个参数没有被指定值。
data1.DataSource = ds.Tables["good"];
adapter.Update(ds, "good");
}
}
}