I guess my question is how do you debug a connection string?
Background Info
Dev Machine is 64bit but I have my build targeting 32bit
Windows Form App targeting .NET 2.0
Has an embedded access database to hold look up values and store some basic information
In App.config
add name="MyConnection" connectionString="Provider = Microsoft.Jet.OLEDB.4.0; Data Source =C:\Development\MyFolder\MyAccessData.mdb;"
As soon as I hit F5 it sets a breakpoint on this line:
connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["MyConnection"].ToString();
try this..
connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["MyConnection"].ConnectionString;
Related
I am having a winform application and a visual studio installer set up project with the project output set to this winform application.
This winform gets invoked from a website as an msi installer which saves the values in the registry for invocation of the winform app the next time as a uri protocol scheme.
Now from the web I want to check 2 things:
1.) Is this application already installed on the client machine?
For this I can put a registry checking code to check for application installed or not
string regKey = #"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall";
using (Microsoft.Win32.RegistryKey key = Registry.LocalMachine.OpenSubKey(regKey))
{
if (key.GetSubKeyNames().Any(keyName => key.OpenSubKey(keyName).GetValue("DisplayName") == "My App's Display Name"))
Console.WriteLine("Already installed...");
else
Console.WriteLine("Start installing...");
}
2.) What is the version of the application installed.
For the version, the registry values as described in point 1 also gives other parameters like "DisplayVersion" and "version, VersionMajor and VersionMinor".
So for the version what is the best way to update the assembly version of the winform application. Should I change the AssemblyInfo class of the winform app or should I change the version in the set up project properties?.
Set up project property:
Also in the registry I get following dword values of versions, how to decode these hexadecimal values to get the version number?.
I want to make a working program written in Java on Mac available to a Windows user, but the connection fails on Windows with a strange error message indicating Windows is looking for the DB in C::\windows\system32. The SQLite DB is located in the same folder as the Java program:
Connection conn = DriverManager.getConnection("jdbc:sqlite:Databasess/Logic1.sqlite");
I've made a JAR and put it in a folder called Aurora, so it looks like this:
TeachingMachine
Aurora.v2.jar
Images
Audio
databases
Logic1.sqlite
Logic2.sqlite
Transfer the entire folder to another Mac and it works perfectly.
Transfer the same folder to my HP running Windows10 and it immediately gives me an error that I had copied from my HP to my Mac:
JAVA.SQL ‘SQLEXCEPTION: path to ’databases/Logic1.sqlite’: C:\windows\system32:’databases’ does not exist
I've searched for pleas for help regarding windows\system32, and larger portions of the error message. I've found some people whose questions involved gremlins in their code for making a connection to SQLite or other databases, but nothing so far mentioning the problem I've outlined here.
There is a folder for system32 on my Windows PC, but I'm trying for a single program that I can maintain and distribute to people running various operating systems. It would be self-defeating to have to copy my databases into system32.
This is the same basic code for connecting I've been using for over a year. There is, of course, no mention of system32.
Connection conn = null;
try {
Class.forName("org.sqlite.JDBC");
conn = DriverManager.getConnection("jdbc:sqlite:databases/Logic2.sqlite");
return conn;
}catch (Exception e)
The expected results are what I get on any Mac that I've tried it on, and the actual result when I run the same code on Windows 10 is that I only get one error message.
The problem you're running in to is the default directory that the process is using.
On windows, it's apparently using c:\windows\system32.
On the Mac, it's using your applications folder.
So, you need to either specify an absolute path for your database URL, or you need to change your current working directory for your application.
I have been looking online for days trying to solve my problems and I cannot find anything which hints as to why I get this issue.
The exception is: System.ArgumentException: Invalid argument
I am using IBM.Data.Informix.dll version 9.0.0.2, the connection string has been through many permutations, but based on most examples from IBM and online this is what I have:
Database=testdb; Host=10.0.0.123; Server=test; Service=3013; User Id=testuser; Password=test123; Protocol=onsoctcp;
I have tried setting Service to the name of the service, I have removed it, even tried setting server to the IP rather than the Host. Whatever I do it just keeps coming up with a useless exception which doesn't help at all in debugging.
I am using the IfxConnection class when instanciating:
using System.Data;
using IBM.Data.Informix;
namespace InformixTest
{
public class InformixConnectionFactory : IConnectionFactory<IDbConnection>
{
private string connectionString;
public InformixConnectionFactory(string connectionString)
{
this.connectionString = connectionString;
}
public IDbConnection GetConnection()
{
return new IfxConnection(connectionString);
}
}
}
Every time it steps into the new IfxConnection(connectionString) the exception is thrown, the connection string is injected via the web.config ConnectionStrings section. I am also targeting .net 4 incase this is a problem.
I was using the v9.5fp4_nt32_dsdriver_EN.exe installer to get the driver installed, I did read somewhere once that someone had a similar issue, so they installed the Informix Client SDK, which fixed their issue. I have also done the same but no such luck.
I am using the following sites as a reference for how my connection string should look:
http://www.ibm.com/developerworks/data/library/techarticle/dm-0510durity/
http://stackoverflow.com/questions/611345/connection-string-for-informix-for-net
Any help would be great!
your connection string works on my machine. I had a lot of problem with IfxConnection because I also installed driver first. Then I unistalled drivers and client sdk, restart windows and installed client sdk again. Just in case I restarted windows again. That did it for me.
Also, I think you should switch (if possible) to IBM Data Server .NET Provider for Informix because old informix driver won't be enhanced any more. Look here for comparison:
http://www.ibm.com/developerworks/data/library/techarticle/dm-1007dsnetids/index.html
You will find that "Informix server support" and "Support for .NET framework 3.0, 3.5" features are quite important and old driver doesn't support it. Also, article doesn't mention that old driver doesn't support database metadata retrieval.
I coded this thing up in VS2010, it worked fine. I needed to port it to VS2008, which went smoothly, aside from fixing how a few lines were worded. But it won't run, and my error codes say it's in opening this database.
com = New OleDbConnection(DB_Path)
com.Open()
With a string at the top defining DB_Path
Public Const DB_Path As String = "Provider=Microsoft.Jet.OleDb.4.0;Data Source=.\ASPNetDB.mdb"
Those two lines of code at the only thing in a Try statement, so they're the only thing that could be going wrong here. And yes, I made sure to copy the database into the new directory. I even tried using the full direct path in there and that didn't work either.
So what have I missed?
On a 64bit machine in VS2008 you need to set the target CPU to 32bit in the project properties, no 64 bit DLL exist for database access. I hope this helps
Just a guess-- but you may have to use a different Jet provider (not 4.0) in VS 2008, since it will be targeting an earlier release of .Net.
The code snippet below works absolutely fine on my development PC and another users PC.
The application was installed to the other users PC using 'ClickOnce'.
ReportWindow reportWindow = new ReportWindow();
Reports.rptDrawAmountSummary rpt = new Reports.rptDrawAmountSummary();
rpt.SetDatabaseLogon(clsArbitrageDB.userID, clsArbitrageDB.password);
reportWindow.crystalReportsViewer1.ViewerCore.ReportSource = rpt;
When I attempt to run the application installed (using ClickOnce) on a different PC the report presents a dialog box displaying the ServerName and two input fields one for UserID (pre-populated) and one for the Password (empty). When I enter the password it says 'Logon Failed'.
The information is definitely correct because this same information is used to provide user access to the application.
I am relatively sure it is WPF CrystalReportViewer related but unsure how to resolve.
UPDATE: Have since determined that if I install the application on any PC that does not have VS2010 installed it has the error. Also, on the PCs with VS2010 installed Crystal Reports for VS2010 doesn't even have to be installed.