V
V
Vitaly Pitalenko2018-08-15 10:19:53
Database
Vitaly Pitalenko, 2018-08-15 10:19:53

How to make OleDbConnection not lose the database?

The essence of the problem is that the program starts on my computer, finds the database and everything works correctly, but when do I transfer the same program to another computer? it starts, but does not see the database. Here is an example of one of the requests:

string SQL_zapros = "INSERT INTO sale (prod_id, qty, price, date_sale) VALUES (" + sale[i].Code + ", " + sale[i].Qty.ToString("0.00", System.Globalization.CultureInfo.GetCultureInfo("en-US")) + ", " + sale[i].Price.ToString("0.00", System.Globalization.CultureInfo.GetCultureInfo("en-US")) + ", NOW())";
                OleDbConnection connection = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;" + @"Data Source=" + Properties.Settings.Default.DBFile);
                OleDbDataAdapter oledbAdapter = new OleDbDataAdapter();
                connection.Open();
                oledbAdapter.UpdateCommand = connection.CreateCommand();
                oledbAdapter.UpdateCommand.CommandText = SQL_zapros;
                oledbAdapter.UpdateCommand.ExecuteNonQuery();
                connection.Close();

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vitaly Pitalenko, 2018-08-23
@Rikisan

The whole problem turned out to be in the Visual C ++
library. Installed the libraries on another computer and everything worked.

#
#, 2018-08-15
@mindtester

1 - did you understand the concept of connection string? where is it?
2 - do you want to see the same base? or on the "other" computer a copy of the database?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question