“System.InvalidOperationException”类型的未经处理的异常出现在 System.Data.dll 中。其他信息: 未在本地计算机上注册“Microsoft.Jet.OLEDB.4.0”提供程序。
程序如下:
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 rw
{
public partial class 录入数据 : Form
{
public 录入数据()
{
InitializeComponent();
}
private void button2_Click_1(object sender, EventArgs e)
{
string nameA = 点名.Text;
string coordinateX = X坐标.Text;
string coordinateY = Y坐标.Text;
string coordinateZ = Z坐标.Text;
string MySqlCon = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=F:\\C#程序\\数字摄影测量.mdb;";
OleDbConnection Con = new OleDbConnection(MySqlCon);
OleDbCommand cmd = new OleDbCommand();
Con.Open();
String sql = "insert into 物方坐标(点名,X坐标,Y坐标,Z坐标) value *" + nameA + "* , *" + coordinateX + "*, *" + coordinateY + "*, *" + coordinateZ + "*)";
if (cmd.ExecuteNonQuery() > 0)
{ MessageBox.Show("输入成功"); }
程序如下:
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 rw
{
public partial class 录入数据 : Form
{
public 录入数据()
{
InitializeComponent();
}
private void button2_Click_1(object sender, EventArgs e)
{
string nameA = 点名.Text;
string coordinateX = X坐标.Text;
string coordinateY = Y坐标.Text;
string coordinateZ = Z坐标.Text;
string MySqlCon = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=F:\\C#程序\\数字摄影测量.mdb;";
OleDbConnection Con = new OleDbConnection(MySqlCon);
OleDbCommand cmd = new OleDbCommand();
Con.Open();
String sql = "insert into 物方坐标(点名,X坐标,Y坐标,Z坐标) value *" + nameA + "* , *" + coordinateX + "*, *" + coordinateY + "*, *" + coordinateZ + "*)";
if (cmd.ExecuteNonQuery() > 0)
{ MessageBox.Show("输入成功"); }