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

    评论

报告相同问题?

悬赏问题

  • ¥17 pro*C预编译“闪回查询”报错SCN不能识别
  • ¥15 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向