【发布时间】:2016-01-14 19:56:13
【问题描述】:
我有一个实施了授权系统的应用程序。它有一个可以登录的用户访问 2013 数据库。该数据库包含三列:用户名、密码和位置。该职位将类似于员工或经理。
成功登录后,用户会看到主表单(form1.vb),但我发生了一些事情。首先更新一个标签,其中包含他们的用户名。而且我正在尝试实现一种方法来更新“位置”标签,具体取决于谁登录。
请记住,我是 vb.net 的新手。为此,我使用 ExecuteScalar 和以下代码:
Using conn As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\Joe\Desktop\Folders\Developing\inventoryManagement\inventoryManager.accdb")
Using command As New OleDb.OleDbCommand("SELECT Position FROM im_users", conn)
conn.Open()
Dim position As String = CStr(command.ExecuteScalar())
Label6.Text = position
End Using
End Using
错误代码=-2147467259
H结果=-2147467259
Message=IErrorInfo.GetDescription 失败,出现 E_FAIL(0x80004005)。
源=系统.数据
堆栈跟踪:
在 >System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(OleDbHResult 小时)
在 >System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS >dbParams,对象和执行结果)
在 System.Data.OleDb.OleDbCommand.ExecuteCommandText(对象& >executeResult)
在 System.Data.OleDb.OleDbCommand.ExecuteCommand(命令行为>行为,对象和执行结果)
在 System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior > 行为,字符串方法)
在 System.Data.OleDb.OleDbCommand.ExecuteScalar()
在 C:\Users\Joe\Desktop\Folders\Developing\inventoryManagement\Home\Home\Form1.vb:>line 10 中的 Home.Form1.Form1_Load(Object sender, EventArgs e)
在 System.Windows.Forms.Form.OnLoad(EventArgs e)
在 System.Windows.Forms.Form.OnCreateControl()
在 System.Windows.Forms.Control.CreateControl(布尔 fIgnoreVisible)
在 System.Windows.Forms.Control.CreateControl()
在 System.Windows.Forms.Control.WmShowWindow(消息和 m)
在 System.Windows.Forms.Control.WndProc(消息和 m)
在 System.Windows.Forms.ScrollableControl.WndProc(消息和 m)
在 System.Windows.Forms.Form.WmShowWindow(消息和 m)
在 System.Windows.Forms.Form.WndProc(消息和 m)
在 System.Windows.Forms.Control.ControlNativeWindow.OnMessage(消息& > m)
在 System.Windows.Forms.Control.ControlNativeWindow.WndProc(消息和 m)
在 System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd,>Int32 msg,IntPtr wparam,IntPtr lparam)
内部异常: 您能告诉我如何纠正这个问题吗?
但是,当我启动应用程序并登录时,它会出现以下异常:
【问题讨论】:
-
请编辑您的问题并在报价中发布异常详细信息
-
InnerException 文本?
-
这是我按下“将例外复制到剪贴板”时的完整例外
标签: vb.net