While googling how to convert a BIT (YESNO) column in an access database to a checkbox programmatically, a possible solution I found was to copy an existing database’s structure by using DoCmd.
I have added a reference to Microsoft.Office.Interop.Access and added those 2 lines in my code:
using Access = Microsoft.Office.Interop.Access;
Access.Application myAccessInstance = new Access.Application();
In the try block where I open a connection to my database I’m executing Do.Cmd.TransferDatabase:
myAccessInstance.DoCmd.TransferDatabase(0, "Microsoft Access", "C:\\Users\\user\\Desktop\\Merge\\playlists.MDB", 0, "PlaylistNames",
"PlaylistNamesCopy", true);
and I get a System.Runtime.InteropServices.COMException:
This operation requires an open database.
Does anyone know what is going wrong?
I do not know C#, so this is a rough example of how to set a field (column) in a table to a checkbox display, which is what I believe this question to be about.