Answer the question
In order to leave comments, you need to log in
How to link access database to c# exe file?
Hello, such a problem, the exe file opens only when it is in the same place as the database file, but I need the exe file to open everywhere, even when the database is in a different place, how can this be done?
The code of the main form associated with the database was not done through the DataSet, as you can see.
string connectString = "Provider=Microsoft.Ace.OleDB.12.0;Data Source=DB.mdb";
private OleDbConnection myConnection;
public Form1()
{
InitializeComponent();
myConnection = new OleDbConnection(connectString);
myConnection.Open();
}
private void СохранитьToolStripMenuItem_Click(object sender, EventArgs e)
{
string zapros = "INSERT INTO table1 (результат) VALUES " + "('" + Convert.ToString(TextBox1.Text) + "')";
OleDbCommand command = new OleDbCommand(zapros, myConnection);
command.ExecuteNonQuery();
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question