Re: [sqlite] Unable to open database file

2014-09-23 Thread Steve Rogers

On 9/23/2014 10:57 PM, Joe Mistachkin wrote:

Steve Rogers wrote:

Reading in order, it says that:
SQLiteDb.LDb3.PrepareCommand threw an exception with the message
'unable to open database file'


Is the database file name a UNC path?  If so, the number of leading
backslashes must be doubled (i.e. four leading backslashes are now
required), e.g.:

//
// NOTE: The C# compiler itself needs the backslashes escaped
//   as well, hence there are 8.
//
string fileName = "server\\share\\path\\to\\database.db";

--


In my test today, the path was C:\Users\Public because I was installing
on the machine that will be the machine to hold the database file.

I'll need to take these comments into account when I get to a fully
qualified UNC name on the other computers.

I haven't tested that scenario yet, but I will do soon.

But the problem remains that the failure I describe in my message was
when the database file was on the same machine.

I'm hoping that when I get the problem resolved that when the user uses a
file picker to pick the file, that the path I get back from the file picker
will be properly "decorated" with all the necessary slashes.  If not I can
handle that problem.





___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


-
No virus found in this message.
Checked by AVG - www.avg.com
Version: 2014.0.4765 / Virus Database: 4025/8264 - Release Date: 09/23/14




___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Unable to open database file

2014-09-23 Thread Steve Rogers

I am working with SQLite code I have developed in .NET 2.0
I have done this development in .NET 2.0 because one of the
installation locations for the database client runs
Windows 2000, controlling a large machine (a beam saw).
The saw was shipped with a computer running Windows 2000,
and has never been upgraded the vendor of the machine. Thus
my .NET code must be able to run on Windows 2000, and since
Windows 2000 supports .NET only up to 2.0, with .NET 2.0.

I've done all my development with .NET 4.0 on a 64-bit
system, but the targeting of the code has been for x64.
I have set the project to use .Net 2.0. I am using
the .Net 2.0 version of the System.Data.SQLite.DLL.

I have demo'd the program to the client w/o my development
system, using an x64 laptop, w/Win7 & .Net 4.0. No problems

The program will run on the following machines at the
client site:

3 each Win 7 32-bit w .Net 4.0
1 each Win2000 32-bit w .Net 2.0

Today I installed the application on one of my client's
computers for the first time (a Win 7 23-bit with
.Net 4.0) in preparation for a complete installation on
all machine.

I installed the following files

// My DLL of application specific stuff
08/26/2014  09:00 PM59,904 Cut85Db.dll

// The GUI and application rules
08/27/2014  09:46 AM   386,048 Cut85Inventory.exe

// The config file shown below
07/27/2014  04:45 PM 2,014 Cut85Inventory.exe.config

// The interop DLL
07/27/2014  04:47 PM   843,776 SQLite.Interop.dll

// A helper DLL for SQLite
08/26/2014  09:00 PM12,288 SQLiteDb.dll

// The main SQLite DLL
06/23/2014  09:56 AM   282,624 System.Data.SQLite.dll

// I don't use LINQ in .NET 2.0, so I don't think I need this
// but it's there
03/19/2014  01:54 PM   183,808 System.Data.SQLite.Linq.dll

// Files created by my installer
08/27/2014  11:36 AM28,627 unins000.dat
08/27/2014  11:35 AM 1,178,825 unins000.exe

The database itself is located in the C:\USERS\PUBLIC
directory of the machine I installed on.

When I ran the application, it ran, and, per design, when not
finding a configured database, provided a dialog to the user
to select the database file.  Then it proceed to run until it
returned the following error:

ERROR ---
Timestamp:  2014-09-23T13:13:10.9914213
System.Data.SQLite.SQLiteException:  unable to open database file
System.ApplicationException:  Error in SQLiteDb.LDb3.PrepareCommand.
System.ApplicationException:  Error in SQLiteDb.LDb3.GetDataTable.
System.ApplicationException:  Error in 
Cut85Db.Composition.GetFirstFieldResults.
System.ApplicationException:  Error in 
Cut85Db.Composition.GetInventoryCoreMaterials.
System.ApplicationException:  Error in 
Cut85Db.Composition.GetInventoryCoreMaterialsIT.
System.ApplicationException:  Error in 
Cut85Inventory.Rules.FilterInterface_Construct.

-

This is a single exception that has the bubbled back to the
caller.

Reading in order, it says that:
SQLiteDb.LDb3.PrepareCommand threw an exception with the message
'unable to open database file'
it was caught by SQLiteDb.LDb3.PrepareCommand
then caught by Cut85Db.Composition.GetFirstFieldResults
the caught by Cut85Db.Composition.GetInventoryCoreMaterials
then caught by Cut85Db.Composition.GetInventoryCoreMaterialsIT
the caught by Cut85Inventory.Rules.FilterInterface_Construct

When the application starts, I call
var DB = new LDb3(Properties.Settings.Default.DBPath);

This creates my LDb3 (Lite Database sql3 helper) with the
current database path.

In FilterInterface_Construct I call GetInventoryCoreMaterialsIT(DB)
GetInventoryCoreMaterialsIT (with the IT suffix) means it
Gets a list of CoreMaterial names with an internally transacted
method called GetInventoryCoreMaterials. This prepares a query
to return the unique set of CoreMaterials known to the database
(a column in a table called Compositions). Since the query only
returns one column in a DataTable, I call GetFirstFieldResults
with the query.

So I can get a connection from my LDB3 helper object, I can
use the connection to get create a command.  In the process of
getting a DataTable from the query, I call a method PrepareCommand,
which looks like this:

private void PrepareCommand(SQLiteCommand command, string sql)
{
var errorLocus = GetErrorLocus();
try
{
if (command.Connection.State == ConnectionState.Closed)
command.Connection.Open();   //  <-Exception thrown here
 // with message
 // 'unable to open database file'
if (command.Connection.State != ConnectionState.Open)
throw new ApplicationException("Connection could not be 
opened.");

command.Parameters.Clear();
command.CommandText = sql;
}
catch (Exception ex) { throw new ApplicationException(errorLocus, 
ex); }

}

So it seems that all the SQLite logic up to the point where I attempt to
open the 

Re: [sqlite] Working with SQLite-Net in Framework 2.0

2014-07-12 Thread Steve Rogers

On 7/11/2014 1:02 AM, Joe Mistachkin wrote:

Steve Rogers wrote:

Can the two versions exist in a VS 2010 development environment on the
same machine?
I hope I have clarified that important detail.


I'm not sure as I've never tested that setup.  I do know that only the
setup package for Visual Studio 2010 (which uses the .NET Framework 4)
will allow it to actually make use of the design-time components for
System.Data.SQLite.

For your particular situation, quite a lot depends on whether or not
you need the design-time support for SQLite.

I do not need design-time support for SQLite in VS2010,  even though I 
have installed it.
I have been using SQLite Expert Personal 3 instead of the design-time 
support in VS2010

because it does more than the design -time support.



https://system.data.sqlite.org/index.html/doc/trunk/www/downloads.wiki




On the above linked page, the "Using Native Library Pre-Loading" and
"Deployment Guidelines" sections merit special attention.

I'll check it out.


--
Joe Mistachkin

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


-
No virus found in this message.
Checked by AVG - www.avg.com
Version: 2014.0.4716 / Virus Database: 3986/7832 - Release Date: 07/10/14




___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Working with SQLite-Net in Framework 2.0

2014-07-10 Thread Steve Rogers

On 7/10/2014 10:28 PM, Joe Mistachkin wrote:

Steve Rogers wrote:

If I install the .NET 2.0 version of SQLite-Net on top of the .NET 4.0
version will that version install in different locations so that I can
manage which version of the components I need to use?


Why are you installing the System.Data.SQLite setup package instead of
deploying application locally?  Are you actually going to use the Visual
Studio designer support?
I think you misinterpreted my question.  For deployment I will only 
deploy the necessary DLL, and only the correct ones for the OS and its 
.NET Framework limitations.  My question concerns only my development 
environment.


This application is an inventory control program for pieces of laminated 
compositions that are left over at a computerized saw. The compositions 
have a top laminate and a bottom laminate and a core material 
((thickness, plywood, particle board, Fiberex).  The saw has the a 
Windows 2000 system.  All the user of the saw needs to do is to input 
leftover scraps from the saw into the database.


In engineering, where designs are made, they have a database of scraps 
that could save them a lot of buck if they could quickly locate s scrap 
that fits into an existing design so that a new 4x8 or 4x10 sheed of 
laminated material would not be needed for just a small pat.  So all the 
correction of editing errors at the sae, and all usage of inventory 
takes place in engineeering where they have .Net 4.0 capable systems.


So I just want to build one input screen for the saw in .NET 2.0 and the 
rest of the complex operation gets done in programs on the computers 
that run .NET 4.0.


So my question is only a development machine question.



Can the two versions co-exist, or will there be problems?


In theory, yes; however, that configuration has *NOT* been tested.
Can the two versions exist in a VS 2010 development environment on the 
same machine?

I hope I have clarified that important detail.


--
Joe Mistachkin

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


-
No virus found in this message.
Checked by AVG - www.avg.com
Version: 2014.0.4716 / Virus Database: 3986/7832 - Release Date: 07/10/14




___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Working with SQLite-Net in Framework 2.0

2014-07-10 Thread Steve Rogers
I have started some SQLite-Net development and it is progressing 
beautifully. I am using the version for .NET 4.0 installed with:


sqlite-netFx40-setup-bundle-x86-2010-1.0.93.0.exe

I now learn that one (and only one) of my deployment targets will be a 
machine using Windows 2000 as a dedicated controller for an industrial
machine.  I cannot install .NET 4.0 on that machine, but I can manage 
.NET 2.0 on Windows 2000. There is a possibility that I could upgrade 
the OS on the industrial machine to Win 7, but that is problematic 
because the manufacturers of the industrial machine want to sell a new 
computer and OS rather that to help their users convert from Win2000 to 
Win7 and they are not being all that helpful.


I note that there are also a version of SQLite-Net for .NET 2.0 that can 
be installed with:


sqlite-netFx20-setup-bundle-x86-2005-1.0.93.0.exe

On my system, the .NET 40 version of the SQLite-Net installation 
installed on Windows 7 in:


C:\Program Files (x86)\System.Data.SQLite\2010\bin

My plan is to compile a special stripped-down version of my database 
application for that odd Windows 2000 installation (which only requires 
a very few parts of the entire application). That application will need 
to be compiled for a .NET 2.0 framework target. The majority of the 
application will continue to be developed using .NET 4.0.


If I install the .NET 2.0 version of SQLite-Net on top of the .NET 4.0 
version will that version install in different locations so that I can 
manage which version of the components I need to use?  Can the two 
versions co-exist, or will there be problems?


I really don't relish losing all the .NET 4.0 development and the loss 
of certain more modern features of C# by maintaining one common 
application compiled for .NET 2.0.





___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users