The access file was added to the project as an "existing element", then the "embedded resource" property was selected in the "action at build" property. I will work with the access file on the principle of oledb c #.

var path = "MyProject.Data.DB.accdb"; 
  • And by chance, the embedded resource is not embedded in the assembly, i.e. in dll? - XelaNimed
  • possible, but must find out the way before working with the file - Aida Sadykova

1 answer 1

No

Before working with a file through OleDb you need to materialize it into a regular file.

If you look at this site, then there is no syntax for working with the embedded file, but only through the file system. This is understandable, since each language can deploy resources in its own way, and OleDb not tied to a specific language.

Here is an example of getting Exe from a resource:

 Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("EmbedExe.regedt32.exe"); FileStream fileStream = new FileStream("new.exe", FileMode.CreateNew); for (int i = 0; i < stream.Length; i++) fileStream.WriteByte((byte)stream.ReadByte()); fileStream.Close(); 
  • materialize in a regular file? what do you mean by that? - Aida Sadykova
  • Well, as I understand it, you keep the file as a resource inside the assembly. Before working with it, you need to get it out of the assembly and save it in the file system. - iluxa1810
  • if not added as a resource. And look for the file in the project folder - Aida Sadykova
  • Well, in this case there are specials. a method by which you can find the directory where the exe file is launched. - iluxa1810
  • one