我正在通过smo进行恢复过程.成功恢复后,我启用了我的数据库
currentDb.Setonline();
currentDb.Setonline();
问题是数据库实例在此之后无法工作.实例无法连接.所以我想我不会关闭我的应用程序.
Application.Exit();
但编写上面的代码不存在我的应用程序,而不是我得到了例外.细节是
输入代码hereSystem.NullReferenceException未处理
Message="Object reference not set to an instance of an object." Source="VitoProject" StackTrace: at VitoProject.backAndRestore.restoreDatabase_Click(Object sender,EventArgs e) in C:\WorkSpace\VitoProject\VitoProject\backAndRestore.cs:line 176 at System.Windows.Forms.Control.OnClick(EventArgs e) at System.Windows.Forms.Button.OnClick(EventArgs e) at System.Windows.Forms.Button.onmouseup(MouseEventArgs mevent) at System.Windows.Forms.Control.WmMouseUp(Message& m,MouseButtons button,Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ButtonBase.WndProc(Message& m) at System.Windows.Forms.Button.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) at System.Windows.Forms.UnsafeNativeMethods.dispatchMessageW(MSG& msg) at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.imsoComponentManager.FPushMessageLoop(Int32 dwComponentID,Int32 reason,Int32 pvLoopData) at System.Windows.Forms.Application.threadcontext.RunMessageLoopInner(Int32 reason,ApplicationContext context) at System.Windows.Forms.Application.threadcontext.RunMessageLoop(Int32 reason,ApplicationContext context) at System.Windows.Forms.Application.Run(Form mainForm) at VitoProject.Program.Main() in C:\WorkSpace\VitoProject\VitoProject\Program.cs:line 18 at System.AppDomain.nExecuteAssembly(Assembly assembly,String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile,Evidence assemblySecurity,String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext,ContextCallback callback,Object state) at System.Threading.ThreadHelper.ThreadStart()
解决方法
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。