I hope this isn't a repost but I couldn't find an answer yet. How can I connect to a LibreOfficeBase-database in C#? I don't have MS Access, that's why I only have Libre. So far, this is what I wrote:
private void add_Click(object sender, EventArgs e)
{
OleDbConnection con = new OleDbConnection();
OleDbCommand cmd = new OleDbCommand();
OleDbDataReader reader;
con.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;" +
"Data Source=C:\\Users\\user\\Desktop\\data.odb;";
cmd.Connection = con;
cmd.CommandText = "INSERT INTO data(name, age)" +
"VALUES('" + FamilyName.Text + "', '" + Age.Text +"')";
try
{
con.Open();
reader = cmd.ExecuteReader();
reader.Close();
con.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
My database is called data.odb and of course it isn't working, because this method is for .accdb files. What do I do for .odb files?
odb is openoffice database. There is a MySQL connector present for working with odb file see here https://wiki.openoffice.org/wiki/Database/Drivers/MySQL_Native/1.0.
Also you might want to go through OpenOffice documentation https://wiki.openoffice.org/wiki/Database#Developer which says how to connect to MS Access https://wiki.openoffice.org/wiki/Connecting_to_Microsoft_Access