SQLite3 ODBC 驱动程序出现 VB6 错误

发布于 2024-07-16 17:04:31 字数 566 浏览 6 评论 0原文

我正在使用 SQLite ODBC 驱动程序(从这里 http://www.ch-werner.de/sqliteodbc /)与我的 VB6 应用程序。 就检索和保存数据而言,一切工作正常,但是,如果我尝试通过以下命令获取表列的列表:

pragma table_info (myTableName)

ADO 调用失败并出现 2 个错误(在 Connection.Errors 属性中找到)

错误 #1:描述: “多步 OLE DB 操作生成错误。检查每个 OLE DB 状态值(如果可用)。未完成任何工作。” : String : cMisDataLayer.ExecuteRecordset

错误#2: 描述:“提供程序不支持该属性。” : String : cMisDataLayer.ExecuteRecordset

我的问题是为什么我会收到此错误,是否有解决方法来获取 SQLite 中表的列列表?

谢谢。

I am using an SQLite ODBC Driver (from here http://www.ch-werner.de/sqliteodbc/) with my VB6 application. Everything works fine, as far as retrieving and saving data, however, if I try to get the list of table columns via the following command:

pragma table_info (myTableName)

The ADO call fails with 2 errors (found in Connection.Errors property)

Error #1: Description : "Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done." : String : cMisDataLayer.ExecuteRecordset

Error #2: Description : "Provider does not support the property." : String : cMisDataLayer.ExecuteRecordset

My question is why am I getting this error and is there a workaround to getting the column list for a table in SQLite?

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

夜血缘 2024-07-23 17:04:31

为什么不直接使用 ADO RecordSet Fields 集合? 只需执行 SELECT * FROM table WHERE 1=0 即可。 当 ADO 获取结果集时,它也会返回所有列信息。

Private Sub cmdTest_Click()

   Dim conTest As ADODB.Connection
   Dim cmdTest As ADODB.Command
   Dim rstResults As ADODB.Recordset
   Dim fldCurrent As ADODB.Field

   Set conTest = New ADODB.Connection
   conTest.ConnectionString = "whatever your connection string is"
   conTest.Open

   Set cmdTest = New ADODB.Command
   cmdTest.CommandType = adCmdText
   cmdTest.CommandTimeout = 30
   cmdTest.CommandText = "SELECT * FROM myTableName WHERE 1=0"

   cmdTest.ActiveConnection = conTest
   Set rstResults = cmdTest.Execute()

   For Each fldCurrent In rstResults.Fields

      Debug.Print fldCurrent.Name & " " & CStr(fldCurrent.Type)

   Next fldCurrent

End Sub

Why not just use the ADO RecordSet Fields collection? Just do a SELECT * FROM table WHERE 1=0. When ADO gets a resultset it returns all the column information as well.

Private Sub cmdTest_Click()

   Dim conTest As ADODB.Connection
   Dim cmdTest As ADODB.Command
   Dim rstResults As ADODB.Recordset
   Dim fldCurrent As ADODB.Field

   Set conTest = New ADODB.Connection
   conTest.ConnectionString = "whatever your connection string is"
   conTest.Open

   Set cmdTest = New ADODB.Command
   cmdTest.CommandType = adCmdText
   cmdTest.CommandTimeout = 30
   cmdTest.CommandText = "SELECT * FROM myTableName WHERE 1=0"

   cmdTest.ActiveConnection = conTest
   Set rstResults = cmdTest.Execute()

   For Each fldCurrent In rstResults.Fields

      Debug.Print fldCurrent.Name & " " & CStr(fldCurrent.Type)

   Next fldCurrent

End Sub
女皇必胜 2024-07-23 17:04:31

虽然我没有使用过 SQLite ODBC,但我想你可以做一个 ADOX 库 - 我想它是用来从数据库获取架构信息的。

页面可能会有所帮助。

While I have not worked with SQLite ODBC, I guess you can do a ADOX library - which I guess is used to get the schema information from the database.

This page might help.

笑叹一世浮沉 2024-07-23 17:04:31

检查您使用的是 Win32 还是 Win64 版本的 SQLite ODBC 驱动程序可能会有所帮助。

Checking whether you are using Win32 or Win64 version of SQLite ODBC Driver might help.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文