Reputation: 195
I've been I'm trying to create an exe file of my application in c# express. My problem is when I run the application.exe after I build from release it shows me an error
System.ArgumentException: An invalid connection string argument has been supplied or a required connection string argument has not been supplied.
at FirebirdSql.Data.FirebirdClient.FbConnectionString.Validate()
at FirebirdSql.Data.FirebirdClient.FbConnection.set_ConnectionString(String value)
at FirebirdSql.Data.FirebirdClient.FbConnection..ctor(String connectionString)
at Mis_Service.Loginfrm.btnLogin_Click(Object sender, EventArgs e) in d:\c sharp projects\samples\Mis-Service\Mis-Service\Loginfrm.cs:line 31
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
I think the error only occurs when I connect to the database firebird. I am using the reference as follows.
using FirebirdSql.Data.FirebirdClient;
When I try to run the program using the start button of c# express the code works fine. Is there something that i missed? I want to make the my application in exe so that i can create an installer using 3rd party software
here is my code in app.config
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<appSettings>
<add key="ProviderName" value="MSDASQL.1"/>
<add key="SecurityInfo" value="False"/>
<add key="Driver" value="Firebird/InterBase(r) driver"/>
<add key="UserID" value="sysdba"/>
<add key="Password" value="masterkey"/>
<add key="Database" value="D:\\database\\DB_GENERAL.FDB"/>
<add key="DataSource" value="localhost"/>
</appSettings>
</configuration>
in my class
conProvider = ConfigurationManager.AppSettings["ProviderName"]; // sample on how i call app.config to string
conString = "Provider=" + conProvider + ";" +
"Persist Security Info=" + conSecurityInfo + ";" +
"Driver=" + conDriver + ";" +
"User ID=" + conUserID + ";" +
"Password=" + conPassword + ";" +
"Database=" + conDatabase + ";" +
"DataSource=" + conDataSource + ";" +
"Charset=NONE;";
Upvotes: 1
Views: 2687
Reputation: 195
I found the solution to my problem. Weirdly enough it is now working. These are what I did.
Upvotes: 1