VB.Net找不到可安装的isam oledb excel

时间:2013-06-30 08:58:08

标签: vb.net oledb excel-2010

我知道这是一个在这里重复过多次的问题,但我已经尝试了所有这些(几乎)并且没有人帮助我。这是我的连接字符串。

Provider=Microsoft.ACE.OLEDB.12.0; Data Source=C:\Users\SalikSadruddin\Documents\Working Data\Sharon\01simple.xlsx; Extended Properties="Excel 14.0;HDR=YES"

我也试过这个:

Provider=Microsoft.ACE.OLEDB.12.0; Data Source=C:\Users\SalikSadruddin\Documents\Working Data\Sharon\01simple.xlsx; Extended Properties="Excel 14.0 XML;HDR=YES"

和此:

Provider=Microsoft.ACE.OLEDB.12.0; Data Source="C:\Users\SalikSadruddin\Documents\Working Data\Sharon\01simple.xlsx"; Extended Properties="Excel 14.0 XML;HDR=YES"

但似乎没有工作,我得到同样的错误

could not find installable ISAM

请帮助我们,我的智慧结束了。 :(
额外信息:

  • 已使用x86
  • DataSource来自OpenFile对话
  • 已安装Access数据库引擎x86
  • 已安装MS Office 2010 x86
  • 使用.NET FW 3.5
  • Visual Studio 2012 Express
  • 使用Windows 8 x64

问候
Salik Sadruddin Merani

2 个答案:

答案 0 :(得分:0)

无法找到可安装的ISAM。

Imports System.Data.OleDb

Public Class Form1     Dim con As New OleDb.OleDbConnection     Dim da As New OleDb.OleDbDataAdapter

Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click
    Me.Close()
End Sub

Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
    Me.txtstdID.Text = ""
    Me.txtstdName.Text = ""
    Me.txtstdPhnno.Text = ""
    Me.cmbGender.Text = ""
    Me.txtAddress.Text = ""
    Me.txtstdID.Focus()


End Sub
Private Sub RefreshData()
    If Not con.State = ConnectionState.Open Then
        con.Open()

    End If
    Dim dt As New DataTable
    ' Dim da As OleDb.OleDbDataAdapter ("select * from student")'

    da.fill(dt)
    con.Close()
    'Me.dgvdata.Datasourece = dt'
End Sub
Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click

    Dim cmd As New OleDb.OleDbCommand
    If Not con.State = ConnectionState.Open Then
        con.Open()
        cmd.Connection = con
        cmd.CommandText = "insert into student(stdid,stdName,stdPhoneNumber,stdGender,stdAddress) values('" & Me.txtstdID.Text & "','" & Me.txtstdName.Text & "','" & Me.txtstdPhnno.Text & "','" & Me.cmbGender.Text & "','" & Me.txtAddress.Text & "')"
        cmd.ExecuteNonQuery()
        con.Close()
        RefreshData()

    End If

End Sub



Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    con = New OleDb.OleDbConnection
    con = New OleDbconnection("provider=Microsoft.ACE.OLEDB.12.0; Datasoure=C:\Documents and Settings\admin\My Documents\Student Management Sys.accdb")
End Sub

结束班

答案 1 :(得分:-1)

检查此代码:

cn.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;data source =D:\ODD_2015\Counselling.xlsx;extended properties=excel 12.0;"
cn.Open()