问题描述
- 刚解除 请求大神解答下呗 谢谢
-
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”(是缺少程序集引用吗?)请问 这个怎么修改呢 刚开始学 到这里 不能调式了 老师报错
时间: 2024-10-03 10:47:26