错误是microsoft.oledb.12.0未在本地计算机上注册 [英] The error is microsoft.oledb.12.0 is not registered on your local machine

查看:102
本文介绍了错误是microsoft.oledb.12.0未在本地计算机上注册的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Windows 10 64位system.in系统安装了microsoft access 2007。我的代码是

尝试

Dim MyConnection As System.Data.OleDb.OleDbConnection

Dim myCommand As New System.Data.OleDb.OleDbCommand

Dim sql As String



MyConnection = New System.Data.OleDb.OleDbConnection(provider = Microsoft.Jet.OLEDB.12.0; Data Source ='+ HistPath +\ Mytage_History.xls';扩展属性= Excel 8.0;)



MyConnection.Open()

myCommand.Connection = MyConnection

If(typ =S)然后

sql =插入[Success $]值('& destination& ','& messg&','& errormsg&','& System.DateTime.Now&')

Else
sql =插入[错误$]值('& destination&','& messg&','& errormsg&','& System.DateT ime.Now&')

结束如果



myCommand.CommandText = sql

myCommand。 ExecuteNonQuery()

MyConnection.Close()

Catch ex As Exception

MsgBox(ex.ToString)

结束尝试



我尝试了什么:



plz解决我的问题.i我面临着这个问题。我已经将所有cpu的内置版改为x86

i have an windows 10 64 bit system.in that system microsoft access 2007 is installed. my code is
Try
Dim MyConnection As System.Data.OleDb.OleDbConnection
Dim myCommand As New System.Data.OleDb.OleDbCommand
Dim sql As String

MyConnection = New System.Data.OleDb.OleDbConnection("provider=Microsoft.Jet.OLEDB.12.0;Data Source='" + HistPath + "\Message_History.xls';Extended Properties=Excel 8.0;")

MyConnection.Open()
myCommand.Connection = MyConnection
If (typ = "S") Then
sql = "Insert into [Success$] values('" & destination & "','" & messg & "','" & errormsg & "','" & System.DateTime.Now & "')"
Else
sql = "Insert into [Error$] values('" & destination & "','" & messg & "','" & errormsg & "','" & System.DateTime.Now & "')"
End If

myCommand.CommandText = sql
myCommand.ExecuteNonQuery()
MyConnection.Close()
Catch ex As Exception
MsgBox(ex.ToString)
End Try

What I have tried:

plz solve my problem.i am facing issue with this.already i have changed the built from any cpu to x86

推荐答案

values('&目的地和','&杂乱无章','& errormsg& ','& System.DateTime.Now& ')

Else

sql =插入[错误
values('" & destination & "','" & messg & "','" & errormsg & "','" & System.DateTime.Now & "')"
Else
sql = "Insert into [Error


值('& destination&' ,'& messg&','& errormsg&','& System.DateTime.Now&')

结束如果



myCommand.CommandText = sql

myCommand.ExecuteNonQuery()

MyConnection.Close()

Catch ex As Exception

MsgBox(ex.ToString)

结束尝试



我是什么尝试过:



plz解决我的问题。我正面临着这个问题。我已经将构建从任何cpu更改为x86
values('" & destination & "','" & messg & "','" & errormsg & "','" & System.DateTime.Now & "')"
End If

myCommand.CommandText = sql
myCommand.ExecuteNonQuery()
MyConnection.Close()
Catch ex As Exception
MsgBox(ex.ToString)
End Try

What I have tried:

plz solve my problem.i am facing issue with this.already i have changed the built from any cpu to x86


很清楚地说 - 计算机上没有安装JET数据库引擎(你可能不应该使用JET,多年前它被ACE取代,永远不可用)在64位版本中。



但这不是你最糟糕的错误:永远不要连接字符串来构建SQL命令。它让您对意外或故意的SQL注入攻击持开放态度,这可能会破坏您的整个数据库。总是使用参数化查询。



连接字符串时会导致问题,因为SQL会收到如下命令:

It's saying - pretty clearly - that the JET DB engine is not installed on the computer (and you probably shouldn't be using JET anyway, it was replaced by ACE many years ago, and will never be available in a 64 bit version).

But that's not the worst of your mistakes: Never concatenate strings to build a SQL command. It leaves you wide open to accidental or deliberate SQL Injection attack which can destroy your entire database. Always use Parameterized queries instead.

When you concatenate strings, you cause problems because SQL receives commands like:
SELECT * FROM MyTable WHERE StreetAddress = 'Baker's Wood'

就SQL而言,用户添加的引号会终止字符串,并且您会遇到问题。但情况可能更糟。如果我来并改为输入:x'; DROP TABLE MyTable; - 然后SQL收到一个非常不同的命令:

The quote the user added terminates the string as far as SQL is concerned and you get problems. But it could be worse. If I come along and type this instead: "x';DROP TABLE MyTable;--" Then SQL receives a very different command:

SELECT * FROM MyTable WHERE StreetAddress = 'x';DROP TABLE MyTable;--'

哪个SQL看作三个单独的命令:

Which SQL sees as three separate commands:

SELECT * FROM MyTable WHERE StreetAddress = 'x';

完全有效的SELECT

A perfectly valid SELECT

DROP TABLE MyTable;

完全有效的删除表格通讯和

A perfectly valid "delete the table" command

--'

其他一切都是评论。

所以它确实:选择任何匹配的行,从数据库中删除表,并忽略其他任何内容。



所以总是使用参数化查询!或者准备好经常从备份中恢复数据库。你定期做备份,不是吗?

And everything else is a comment.
So it does: selects any matching rows, deletes the table from the DB, and ignores anything else.

So ALWAYS use parameterized queries! Or be prepared to restore your DB from backup frequently. You do take backups regularly, don't you?


这篇关于错误是microsoft.oledb.12.0未在本地计算机上注册的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆