I am currently launching an application that runs around the clock and constantly collects information from OPC-sever.
Now I need to send this information to the database (.accdb file). This should happen very quickly. I get a new value from the server every milliseconds, and I need to send this value to the database at the same speed. Finally, I compress the database into a .zip file at 00:00 every day.
I searched the Internet like a maniac, but I canβt find a βmodernβ textbook. Everyone I have found so far uses "Microsoft.Jet.OLEDB.4.0" as a provider, but it does not work on my Windows 7 PC.
I made a small application for testing the connections, and I will attach my current code below to give you a hint that I have tried so far, but all this does not seem to work.
private void button1_Click(object sender, EventArgs e)
{
System.Reflection.Assembly oAssembly = System.Reflection.Assembly.GetExecutingAssembly();
System.IO.Stream oStream = oAssembly.GetManifestResourceStream("RSLogixDB.accdb");
System.IO.FileStream fileStream = new System.IO.FileStream("C:\\Users\\sezettersth\\Documents\\RSLogixDB.accdb", System.IO.FileMode.Create);
byte[] abyt = new byte[oStream.Length];
oStream.Read(abyt, 0, (int)oStream.Length);
fileStream.Write(abyt, 0, (int)oStream.Length);
fileStream.Close();
if (fileStream != null)
{
fileStream.Close();
fileStream = null;
}
if (oStream != null)
{
oStream = null;
}
}
This is the first approach I tried, here I use the home class, which is used to create and write to files. This does not work for .accdb files, unfortunately. (The comments on the first lines refer to the providers I tried.
private void button1_Click(object sender, EventArgs e)
{
string RSLogixDB = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\Users\\sezettersth\\Documents\\RSLogixDB.accdb;Persist Security Info=False";
string RSLogixDBPath = "C:\\Users\\sezettersth\\Documents\\RSLogixDB.accdb";
OleDbConnection connection = new OleDbConnection(RSLogixDB);
string connectionStr = connection.ConnectionString;
ImportExport textwriter = new ImportExport();
textwriter.setExportPath(RSLogixDBPath);
textwriter.endExport();
}
There should be a simple solution, I cannot be the only one using Access without the Microsoft.Jet.OLEDB.4.0 provider.
(I did not run the code for the zip file, and if you have an idea on how to do this, I am glad to hear it, but the focus here is on the database problem.)
: , , Microsoft.ACE.OLEDB.12.0 .accdb, txt , MS Access. .accdb?