我用的是access的数据库, 未处理的“System.Data.OleDb.OleDbException”类型的异常出现在 system.data.dll 中。
请问怎么处理的???

解决方案 »

  1.   

    using System;
    using System.Drawing;
    using System.Collections;
    using System.ComponentModel;
    using System.Windows.Forms;
    using System.Data;
    using System.Data.OleDb;namespace y
    {
    /// <summary>
    /// Form1 的摘要说明。
    /// </summary>
    public class Form1 : System.Windows.Forms.Form
    {
    private System.Windows.Forms.Label label1;
    private System.Windows.Forms.Label label2;
    private System.Windows.Forms.Label label3;
    private System.Windows.Forms.Label label4;
    private System.Windows.Forms.TextBox textBox1;
    private System.Windows.Forms.TextBox textBox2;
    private System.Windows.Forms.TextBox textBox3;
    private System.Windows.Forms.Button button1;
    private System.Windows.Forms.Button button2;
    private System.Windows.Forms.Button button3;
    private System.Windows.Forms.Button button4;
    private System.Data.OleDb.OleDbConnection oleDbConnection1;
    private System.Data.OleDb.OleDbCommand oleDbCommand1;
    private System.Data.OleDb.OleDbCommand oleDbUpdateCommand1;
    private System.Data.OleDb.OleDbDataAdapter oleDbDataAdapter1;
    private y.DataSet1 dataSet11;
    private System.Data.OleDb.OleDbConnection oleDbConnection2;
    private System.Data.OleDb.OleDbCommand oleDbCommand2;
    private System.Data.OleDb.OleDbCommand oleDbUpdateCommand2;
    private System.Data.OleDb.OleDbDataAdapter oleDbDataAdapter2;
    private y.DataSet2 dataSet21;
    private System.Data.OleDb.OleDbConnection oleDbConnection3;
    private System.Data.OleDb.OleDbCommand oleDbCommand3;
    private System.Data.OleDb.OleDbCommand oleDbUpdateCommand3;
    private System.Data.OleDb.OleDbDataAdapter oleDbDataAdapter3;
    private y.DataSet3 dataSet31;
    private System.Windows.Forms.DataGrid dataGrid1;
    private y.DataSet1 dataSet12;
    /// <summary>
    /// 必需的设计器变量。
    /// </summary>
    private System.ComponentModel.Container components = null;
      

  2.   

    ublic Form1()
    {
    //
    // Windows 窗体设计器支持所必需的
    //
    InitializeComponent(); //
    // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
    //
    } /// <summary>
    /// 清理所有正在使用的资源。
    /// </summary>
      

  3.   

    private void button1_Click(object sender, System.EventArgs e)
    {
    oleDbDataAdapter1.SelectCommand.CommandText="select * from train where (车次=?)";
    oleDbDataAdapter1.SelectCommand.Parameters["车次"].Value=textBox1.Text;
    oleDbDataAdapter1.Fill(dataSet11);
    }
    主要是这段代码了