ADOX例外:类未注册

时间:2018-04-26 16:50:36

标签: c# visual-studio visual-studio-2017 adox

我正在尝试使用Visual Studio 2017中的Windows窗体应用程序在C#中创建数据库。无论我尝试什么,我都会遇到同样的错误。我知道每个人都说它是x64的东西,但我把我的平台设置为x86。

这是错误

System.Runtime.InteropServices.COMException
  HResult=0x80040154
  Message=Class not registered
  Source=Ex3
  StackTrace:
   at ADOX._Catalog.Create(String ConnectString)
   at Ex3.FmMenu.FmMenu_Load(Object sender, EventArgs e) in C:\Users\benjo\Apps\CS\CSharp\Ex3\Ex3\FmMenu.cs:line 26
   at System.Windows.Forms.Form.OnLoad(EventArgs e)
   at System.Windows.Forms.Form.OnCreateControl()
   at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
   at System.Windows.Forms.Control.CreateControl()
   at System.Windows.Forms.Control.WmShowWindow(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.Form.WmShowWindow(Message& m)
   at System.Windows.Forms.Form.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

这是我试图开始工作的代码,错误发生在第一行

new ADOX.Catalog().Create(Program.ConnString);
OleDbConnection Conn = new OleDbConnection(Program.ConnString);
Conn.Open();
OleDbCommand Cmd = new OleDbCommand();
Cmd.Connection = Conn;

每个人都说我应该尝试将我的程序设置为以32位模式运行,但这并未改变任何内容

0 个答案:

没有答案