1
I have a new problem in the same method, the place in bold and italics accuses an unrecognized class problem, some hint how to solve? Code to follow:
public static void CompactarMdb(string caminhoaccdb){
JRO.JetEngine jetEngine = (JRO.JetEngine)Activator.CreateInstance(Type.GetTypeFromProgID("JRO.JetEngine"));
var arquivoTemporario = System.IO.Path.GetTempFileName();
arquivoTemporario = System.IO.Path.ChangeExtension(arquivoTemporario, "accdb");
string templateConnectionString = "Data Source={0}; Provider=Microsoft.Jet.OLEDB.12.0;";
string connectionStringFonte = string.Format(templateConnectionString, caminhoaccdb);
string connectionStringTemp = string.Format(templateConnectionString, arquivoTemporario);
***jetEngine.CompactDatabase(connectionStringFonte, connectionStringTemp);***
System.IO.File.Copy(arquivoTemporario, caminhoaccdb, true);
System.IO.File.Delete(arquivoTemporario);
}
I made the reference, but the error persists, I do not rule out to have made wrong, some hint to reference ?
– user93952
In Solution Explorer right click on References and Add Reference. It will open a window, click Browser and locate the DLL, after that can give OK. Note later that this new reference will be inside the references tab there. Here I did the same the code compiled normally.
– Thiago Loureiro
I did, but the problem persists, unfortunately
– user93952
But even compile (build) or not even that? or error when it will run?
– Thiago Loureiro
Compiled and rotated, but when I run the code I posted here, the unrecognized class error persists
– user93952
I’ll test it here, I’ll hunt a mdb to do.
– Thiago Loureiro
Let’s go continue this discussion in chat.
– Thiago Loureiro
Solved the problem, thank you so much for the help on chat. Hug!
– user93952