与Sqlite3接口的麻烦 [英] Interfacing with Sqlite3 trouble
问题描述
Windows 8 Phone
Windows 8 Phone
我无法与Windows Phone sqlite3 dll交互.
I am having trouble interfacing with the Windows Phone sqlite3 dll.
我在Windows 8 Desktop上使用了此接口代码,但是在Windows Phone上使用它时,出现错误.
I have this interface code working on Windows 8 Desktop but when I use it on the Windows Phone it gives me an error.
当然,我知道Windows Phone的DLL与Windows Desktop的DLL是不同的,但我假设两者的接口是相同的.
Of course , there I realize that the Windows Phone has a different DLL than for the Windows Desktop but I am assuming the interface to each is the same.
我在应用程序中使用VB
I am using VB in my application
- 这是我如何安装Sqlite3 dll和所使用的版本.
;
用于Windows Phone 3.7.15.1的SQLite
Sqlite for Windows Phone 3.7.15.1
安装在
C:\ Program Files(x86)\ Microsoft SDKs \ Windows Phone \ v8.0 \ ExtensionSDKs \ SQLite.WP80 \ 3.7.15.1 \
C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\ExtensionSDKs\SQLite.WP80\3.7.15.1\
- 我用来连接Sqlite3的代码.当我执行Open语句时,代码炸毁了.我能够检测到该sql文件正在工作存储中.
Dim 如 StorageFolder = Windows.Storage. ApplicationData
Dim localFolder As Windows.Storage.StorageFolder = Windows.Storage.ApplicationData.Current.LocalFolder
Dim 路径 ApplicationData "MyDataBase.sqlite"
Dim dbPath = Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, "MyDataBase.sqlite")
Dim 如 IsolatedStorageFile
Dim isf As IsolatedStorageFile
isf = IsolatedStorageFile
isf = IsolatedStorageFile.GetUserStoreForApplication()
如果 真 然后
If (isf.FileExists(dbPath) = True) Then
SQLOK = Open(dbPath,db)
endif
‘我正在使用的sqlite3 dll界面
‘ the interface I am using to the sqlite3 dll
< ( "sqlite3" "sqlite3_open" CallingConvention
<DllImport("sqlite3", EntryPoint:="sqlite3_open", CallingConvention:=CallingConvention.Cdecl)> _
公共 功能 ByVal 文件名 如 字符串 ByRef 如 IntPtr 如 整数
Public Function Open(ByVal filename As String, ByRef db As IntPtr) As Integer
结束 功能
End Function
- 在执行Open for Sqlite3时出现以下错误
执行时,我在此位置检测到sql文件.我假设这是工作存储区中的正确位置– YYYYYY是文件名
When I execute I am detecting the sql file at this location. I am assuming that this is the correct location in the working storage – YYYYYY is the name of the file
dbPath ="C:\ Data \ Users \ DefApps \ AppData \ {6AAA4956-725D-440B-A801-F370CFAD1001} \ Local \ YYYYYY.sqlite"
dbPath = "C:\Data\Users\DefApps\AppData\{6AAA4956-725D-440B-A801-F370CFAD1001}\Local\YYYYYY.sqlite"
XXXXX.DLL中发生了'System.TypeInitializationException'类型的异常,但未在用户代码中处理
An exception of type 'System.TypeInitializationException' occurred in XXXXX.DLL but was not handled in user code
System.TypeInitializationException未通过用户代码处理
System.TypeInitializationException was unhandled by user code
HResult = -2146233036
HResult=-2146233036
Message ='XXXXX.UtilityTest'的类型初始值设定项引发了异常.
Message=The type initializer for ' XXXXX.UtilityTest' threw an exception.
Source = XXXXX
Source= XXXXX
TypeName = WIn8Calc.UtilityTest
TypeName=WIn8Calc.UtilityTest
StackTrace:
StackTrace:
在XXXXX.UtilityTest.VB $ StateMachine_1_SetConnectionString.MoveNext()
at XXXXX.UtilityTest.VB$StateMachine_1_SetConnectionString.MoveNext()
InnerException:System.NotImplementedException
InnerException: System.NotImplementedException
HResult = -2147467263
HResult=-2147467263
Message =该方法或操作未实现.
Message=The method or operation is not implemented.
Source = Windows
Source=Windows
StackTrace:
StackTrace:
在Windows.Storage.ApplicationData.get_LocalSettings()
at Windows.Storage.ApplicationData.get_LocalSettings()
在XXXXX.UtilityTest..cctor()
at XXXXX.UtilityTest..cctor()
InnerException:
InnerException:
XXXX是我的应用的名称
Where XXXX is the name of my app
有人可以帮助我吗?
推荐答案
我怀疑您需要为WP8目标编译DLL.
I suspect you'll need to compile the DLL for the WP8 target.
可能的追求途径是:
Hope this helps,
Mark
这篇关于与Sqlite3接口的麻烦的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!