无法访问数据库 [英] failed to access access db

查看:88
本文介绍了无法访问数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在vb中,您是一个新手吗?非常感谢您提前提供的帮助
我下面的代码给了我我要解决的错误
``Microsoft.ACE.OleDb.12.0数据源= c:\ trail.accdb''提供程序未在本地计算机上注册.

Well am a newbie in vb any help is highly appreciated thank you in advance
My code below gives me an error i seek to resolve
The ''Microsoft.ACE.OleDb.12.0 data source = c:\trail.accdb'' provider is not registered on the local machine.

Imports System.Data.OleDb
Public Class frm_patientrecords
    'making the database connection
    Dim con As New OleDbConnection
    Private Sub DataGridView1_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick
        con.ConnectionString = "Provider=microsoft.jet.oledb.4.0; data source = C:\trail.accdb"
        con.Open()
        datagridShow()
    End Sub
    'call the grid property and object
    Private Sub datagridShow()
        Dim ds As New DataSet
        Dim dt As New DataTable
        'parse the data set into the table
        ds.Tables.Add(dt)
        Dim da As New OleDbDataAdapter
        da = New OleDbDataAdapter("select * from patients", con)
        da.Fill(dt)
        DataGridView1.DataSource = dt.DefaultView
        con.Close()
    End Sub
End Class

推荐答案

对于版本12.0,您需要在http://www.microsoft.com/zh-cn/download/details.aspx?id=13255上安装MDAC2010.

这必须在发布应用程序的服务器上完成.如果目标计算机是32位,则需要安装x86版本;如果目标计算机是64位,并且您的应用程序是通过配置Any CPU配置的,则需要安装x64版本.
它将解决此问题.
For version 12.0 you need to install MDAC 2010 at http://www.microsoft.com/en-us/download/details.aspx?id=13255.

This has to be done on the server where you publish your application. You need to install the x86 version if the target machine is 32 bit or the x64 version if the target machine is 64 bit and your application is built with configuration Any CPU

It will resolve this issue.


这篇关于无法访问数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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