This feels like a dumb question but I am a bit confused. I am building a C# address book application (Windows Form) that adds, deletes, selects, and updates contacts to an Access database and I'm using DataGridView in the application to show the contacts. I follow the easy steps in connecting to an access database using the wizard, which is Add New Data Source --> Database --> DataSet, then for the Data source I use Microsoft Access Database File (OLE DB), and for the Database FileName, I pick a file on my computer, as shown below.
Now I am confused, because I have to present this on another computer?? Obviously, it won't have the same file address as the one I circled for my computer. Is there a different way to do this or something, I'm not sure what to do. I've heard something about mdb files, but I just have to run the executable file on their computers, so I don't know... I use Access 2016, but the computer I am presenting on uses 2013. Thanks
Okay, nevermind. I found out that I can simply edit the connection string code. I have to test it once in visual studio, then it works appropriately.
public Form1()
{
InitializeComponent();
conn.ConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\Chris\Documents\mydb.accdb;
Persist Security Info=False;";
}
to
public Form1()
{
InitializeComponent();
conn.ConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\OtherComputer\Desktop\mydb.accdb;
Persist Security Info=False;";
}