w341321471 2014-04-15 01:19
浏览 763

刚解除 请求大神解答下呗 谢谢

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.OleDConnection;

namespace personManagement
{
public partial class Form3 : Form
{
public Form3()
{
InitializeComponent();
}

    private void Form3_Load(object sender, EventArgs e)
    {
        this.Text = "删除员工信息";
        label1.Text = "请输入所要删除的名字:";
        label1.AutoSize = true;
        textBox1.Text = "";
        button1.Text = "删除";
        button2.Text = "取消";

    }

    private void button2_Click(object sender, EventArgs e)
    {
        this.Close();

    }

    private string myConnectionString =

@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\ygxxb.accdb";
private int myExecuteNoQuery(string sql)
{
OleDbConnection cnn = new OleDbConnection(myConnectionString);
cnn.Open();
OleDbCommand cmd = new OleDbCommand(sql, cnn);
cmd.CommandType = CommandType.Text;
int i = cmd.ExecuteNonQuery();
cnn.Close();
return i;
}

    private void button1_Click(object sender, EventArgs e)
    {
        string sql = string.Format
    ("delete from person where 姓名 = '{0}'", textBox1.Text);
        int flag = myExecuteNoQuery(sql);
        if (flag > 0)
            MessageBox.Show("删除记录成功!", "删除员工提示");
        else
            MessageBox.Show("删除记录失败!", "删除员工提示"); 

    }
}

}
命名空间“System”中不存在类型或命名空间名称“OleDConnection”(是缺少程序集引用吗?)

请问 这个怎么修改呢 刚开始学 到这里 不能调式了 老师报错

  • 写回答

0条回答

    报告相同问题?

    悬赏问题

    • ¥50 汇编语言除法溢出问题
    • ¥65 C++实现删除N个数据列表共有的元素
    • ¥15 Visual Studio问题
    • ¥15 state显示变量是字符串形式,但是仍然红色,无法引用,并显示类型不匹配
    • ¥20 求一个html代码,有偿
    • ¥100 关于使用MATLAB中copularnd函数的问题
    • ¥20 在虚拟机的pycharm上
    • ¥15 jupyterthemes 设置完毕后没有效果
    • ¥15 matlab图像高斯低通滤波
    • ¥15 针对曲面部件的制孔路径规划,大家有什么思路吗