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 用三极管设计—个共射极放大电路
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示