Hi all,
i am creating one window service in this onStart i am writing code for SQlite query as below
protected override void OnStart(string[] args){
#if (DEBUG)
Debugger.Launch();
string ns = "insert into test (Name,Version,Date) values ('new',6,'2012-12-12')";
//sn.ConnectionString = "Data Source=sumit.s3db;Version=3;New=False;Compress=True;";
sn = new SQLiteConnection(@"Data Source=E:\sumit.s3db;Version=3;New=False;Compress=True;");
sn.Open();
cmd = sn.CreateCommand();
cmd.CommandText = ns;
cmd.ExecuteNonQuery();
sn.Close();
#endif
}
But i am getting error"Unable to load DLL 'SQLite.Interop.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)"
even i put this .dll in bin folder also but its not working abd same code running in my C# application without any error.
Sumit KumawatPosted Mar 30, 2012, 2:01 AM
Please find below error while running test.exe in sqlite's bin folder.
" Unhandled exception has occurred in your application. If you click Continue.the application will ignore this error and attempt to continue.if you click Quit.the application will close immediately.
Exception has been thrown by the target of an invocation"
Thanks
Sumit
Gohil JayendrasinhPosted Mar 29, 2012, 7:45 AM
The interop DLL contains unmanaged code and can not be installed in the GAC. System.Data.SQLite.dll makes calls to this DLL, and thus needs to be able to find it. Some possible work arounds:
1) try copying the interop DLL to the same directory as where the SDS DLL was installed 2) try adding the directory containing the interop DLL to the path
If those fail, please try this and report the results:
Run the appropriate "setup" from the downloads page and install to a temp directory like "C:\temp\System.Data.SQLite" - this is so it is writeable. Choose all the default options for installation. Run the test utility - "C:\temp\System.Data.SQLite\bin\test.exe". Does it work? What errors are reported?