Answer the question
In order to leave comments, you need to log in
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
The whole problem turned out to be in the Visual C ++
library. Installed the libraries on another computer and everything worked.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question