I'm new to the coding world and therefore this maybe a stupid thing. I have coded a SW that will copy files to local disk and run a specific CMD command. The paths are stored in a database on the internal server. All works great on my computer. The released version and the installer etc etc.
(even the program does what it should, I'm in shock...)
But when I use the setup on another computer it wont run. I can see it working and I have looked in the Event log and found this:
Application: EAC600Programing.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.InvalidOperationException
at System.Data.OleDb.OleDbServicesWrapper.GetDataSource(System.Data.OleDb.OleDbConnectionString, System.Data.OleDb.DataSourceWrapper ByRef)
at System.Data.OleDb.OleDbConnectionInternal..ctor(System.Data.OleDb.OleDbConnectionString, System.Data.OleDb.OleDbConnection)
at System.Data.OleDb.OleDbConnectionFactory.CreateConnection(System.Data.Common.DbConnectionOptions, System.Data.Common.DbConnectionPoolKey, System.Object, System.Data.ProviderBase.DbConnectionPool, System.Data.Common.DbConnection)
at System.Data.ProviderBase.DbConnectionFactory.CreateConnection(System.Data.Common.DbConnectionOptions, System.Data.Common.DbConnectionPoolKey, System.Object, System.Data.ProviderBase.DbConnectionPool, System.Data.Common.DbConnection, System.Data.Common.DbConnectionOptions)
at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(System.Data.Common.DbConnection, System.Data.ProviderBase.DbConnectionPoolGroup, System.Data.Common.DbConnectionOptions)
at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(System.Data.Common.DbConnection, System.Threading.Tasks.TaskCompletionSource`1, System.Data.Common.DbConnectionOptions, System.Data.ProviderBase.DbConnectionInternal, System.Data.ProviderBase.DbConnectionInternal ByRef)
at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(System.Data.Common.DbConnection, System.Data.ProviderBase.DbConnectionFactory, System.Threading.Tasks.TaskCompletionSource`1, System.Data.Common.DbConnectionOptions)
at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(System.Data.Common.DbConnection, System.Data.ProviderBase.DbConnectionFactory, System.Threading.Tasks.TaskCompletionSource`1, System.Data.Common.DbConnectionOptions)
at System.Data.ProviderBase.DbConnectionInternal.OpenConnection(System.Data.Common.DbConnection, System.Data.ProviderBase.DbConnectionFactory)
at System.Data.OleDb.OleDbConnection.Open()
at Session.Broker.GetVersionFromDB(System.String)
at EAC600Programing.Main.Fill()
at EAC600Programing.Main..ctor()
at EAC600Programing.Program.Main()
Main.Fill is a function I use to fill inn the combo boxes with data from the database. It again uses a couple of functions (seen on youtube and read in stackoverflow about them) that connects to the database and gets data. (Broker is separated into its own class file) I do not have the competence to figure this out at the moment, so if anyone could help, would be great. PS. already checked if same .Net versions. They are the same. (big corp pc network, so all pc's are the same.) And yes, full network access on both pc's and users.
Broker b = new Broker();
private void Fill()
{
combo_BootCOC.DataSource = b.GetVersionFromDB("BootCOC");
combo_BootBMS.DataSource = b.GetVersionFromDB("BootBMS");
combo_BootMCS.DataSource = b.GetVersionFromDB("BootMCS");
combo_MainCOC.DataSource = b.GetVersionFromDB("MainCOC");
combo_MainBMS.DataSource = b.GetVersionFromDB("MainBMS");
if (cb_Compact.Checked)
{
combo_MainMCS.DataSource = b.GetVersionFromDB("MainMCSCompact");
}
else
{
combo_MainMCS.DataSource = b.GetVersionFromDB("MainMCS");
}
}
public class Broker
{
OleDbConnection connection;
OleDbCommand command;
private void ConnectTo()
{
connection = new OleDbConnection(@"Provider = Microsoft.ACE.OLEDB.12.0; Data Source = N:\Release\Electric Solution\1 Production\03 Tools\05 EAC600 Programming\DataBase.accdb");
try
{
command = connection.CreateCommand();
}
catch (Exception)
{
throw;
}
}
public Broker()
{
ConnectTo();
}
public List<double> GetVersionFromDB(string db)
{
List<double> versionList = new List<double>();
try
{
command.CommandText = "SELECT * FROM " + db;
command.CommandType = CommandType.Text;
connection.Open();
OleDbDataReader reader = command.ExecuteReader();
while (reader.Read())
{
double v;
v = Convert.ToDouble(reader["swVersion"]);
versionList.Add(v);
}
return versionList;
}
catch (Exception)
{
throw;
}
finally
{
if (connection != null)
{
connection.Close();
}
}
}
EDIT1:
Soooo, i got rid of the first problem by installing Access 2010, and ended with this problem:
Application: EAC600Programing.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.FormatException
at System.Number.ParseDouble(System.String, System.Globalization.NumberStyles, System.Globalization.NumberFormatInfo)
at System.String.System.IConvertible.ToDouble(System.IFormatProvider)
at System.Convert.ToDouble(System.Object)
at Session.Broker.GetVersionFromDB(System.String)
at EAC600Programing.Main.Fill()
at EAC600Programing.Main..ctor()
at EAC600Programing.Program.Main()
So heading back in to see what i did wrong.