1
Vote

Connection Open Fails

description

1) Downloading this version of source http://multirdpc.codeplex.com/SourceControl/ListDownloadableCommits.aspx#DownloadLatest (10/02/2009)
2) Putting into a new project VS C# Express 2008, compiling and running in debug mode. Issues this Exception/Stack Trace:
 
System.Data.SQLite.SQLiteException was unhandled
Message="Unable to open the database file"
Source="System.Data.SQLite"
ErrorCode=-2147467259
StackTrace:
   at System.Data.SQLite.SQLite3.Open(String strFilename, SQLiteOpenFlagsEnum flags, Int32 maxPoolSize, Boolean usePool)
   at System.Data.SQLite.SQLiteConnection.Open()
   at Database.Database.ExecuteQuery(String sql_query, SQLiteParameter[] parameters, SQLiteDataReader& reader) in Database.cs:line 32
   at Database.Servers.Read() in Servers.cs:line 32
   at MultiRemoteDesktopClient.Program.Main(String[] args) in Program.cs:line 22
   at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
   at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()
InnerException:
 
3) Working from problem backwards:
The _Connection object looks like this:
_connection
{System.Data.SQLite.SQLiteConnection}
base {System.Data.Common.DbConnection}: {System.Data.SQLite.SQLiteConnection}
ConnectionString: "Data Source=C:\\MultiRDP\\RemoteDesktopClient\\bin\\Debug\\App.Data\\ApplicationDatas.s3db;Version=3;New=False;Compress=True;"
Database: "main"
DataSource: null
DefaultTimeout: 30
 
The _connection type is SQLiteConnection found in the namespace System.Data.SQLite which comes with the project download.
 
The connection string is Data Source=C:MultiRDP\RemoteDesktopClient\bin\Debug\App.Data\ApplicationDatas.s3db;Version=3;New=False;Compress=True;
 
I found this file under the App Data folder and changed the attribute to Copy if newer and the application started right up.
 
SOLUTION:
In your project go to the App Data Folder and mark this file "ApplicationDatas.s3db" property "Copy to output Directory" as "Copy if newer" or "Copy Always"
 
BTW, thanks for this work.

comments