yd930526 2015-04-25 08:51 采纳率: 0%
浏览 1619

VS2010运行会出现这个bug

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;

namespace WindowsFormsApplication1
{
public partial class 主界面 : Form
{
OleDbDataAdapter adapter;
DataTable table = new DataTable();
string str = @"Provider=Microsoft.Jet.OLEDB.12.0;
DataSource=D:\4S店销售\DB.accdb";
OleDbConnection connection = new OleDbConnection();

public 主界面()
{
InitializeComponent();
}

    private void 主界面_Load(object sender, EventArgs e)
    {
        textBox1.Text = textBox2.Text = string.Empty;
    }

    private void button1_Click(object sender, EventArgs e)
    {
        if (textBox1.Text != "" && textBox2.Text != "")
        {
            string sql = "select * from user where ID ='" + textBox1.Text + "' and 密码 = '" + textBox2.Text + "'";
            adapter = new OleDbDataAdapter(sql, str);
            OleDbCommandBuilder buider = new OleDbCommandBuilder(adapter);
            adapter.InsertCommand = buider.GetInsertCommand();
            table.Clear();
            adapter.Fill(table);
            if (table.Rows.Count > 0)
            {
                Form 新建客户信息 = new 新建客户信息();
                新建客户信息.Show();
                this.Hide();
            }
        }
        else
        {
            MessageBox.Show("用户名或密码不能为空");
        }

        if (radioButton1.Checked == true)
        {
            this.Hide();
            new 新建客户信息().ShowDialog();

        }
        else if (radioButton2.Checked == true)
        {
            this.Hide();
            new 员工信息().ShowDialog();
        }
    }

    private void button2_Click(object sender, EventArgs e)
    {
        Application.Exit();

    }

    private void radioButton1_CheckedChanged(object sender, EventArgs e)
    {

    }

    private void radioButton2_CheckedChanged(object sender, EventArgs e)
    {

    }
}

}
图片说明

  • 写回答

2条回答 默认 最新

  • 宇峰科技 2015-04-25 09:39
    关注

    你用到其他什么控件了吗?要么重新安装VS

    评论

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog