我一直试图解决这个问题,但每次尝试修复它时都会遇到同样的错误。我正在尝试将数据库中的数据实现为烛台样式图表。每次运行它我都面临同样的错误:
"未处理的类型' System.Data.OleDb.OleDbException'发生在System.Data.dll
中其他信息:IErrorInfo.GetDescription因E_FAIL(0x80004005)而失败。"
我已经使用了给我的有限资源和我在此前回答的问题中找到的代码的组合来创建以下代码。
Imports System.Data
Imports System.Data.OleDb
Public Class Form1
Dim myConnection As OleDbConnection = New OleDbConnection
Dim provider As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source ="
Dim dataFile As String = "C:\Users\Ian\Documents\A2 Woking\Computing\Database1\Database_data_source .accdb"
Dim DatabasePass As String = "DatabasePW"
Dim connString As String = provider & dataFile
Dim execute As OleDbDataReader
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
myConnection.ConnectionString = connString
Dim objDataAdapter As OleDbCommand = New OleDbCommand("Select Time, Open, High, Low, Last FROM EUR_USD_TB", myConnection)
myConnection.Open()
execute = objDataAdapter.ExecuteReader
While execute.Read
chartTemplate.Series("dataSeries").Points.AddXY(execute("Time"), execute("Low"), execute("High"), execute("Open"), execute("Last"))
End While
' Close the reader and the connection
execute.Close()
myConnection.Close()
End Sub
End Class
任何帮助都将不胜感激,我确信它的内容非常简单,我无法获得。
路径正确--- 数据库不受密码保护,该变量供以后使用--- 查询适用于访问--- 这个相同的代码非常适合访问我登录中的单独表格