查询时出现 OLEDB Oracle 未指定错误(E_FAIL(0x80004005))
OLEDB Oracle Unspecified Error(E_FAIL(0x80004005)) on query
我正在尝试 运行 一个查询,连接发生了,但是当命令执行 运行s 时,我得到了上面的错误。
这是我想要的查询 运行:
SELECT COUNT(*) 来自 name = :name AND pwd = :pwd;
的用户
我的连接字符串:
供应商=OraOLEDB.Oracle;用户ID = HR;密码 = hr;
规格:
- C# WinForms
- 甲骨文 11
- 使用 Oracle XE
我尝试过的步骤:
- 实时服务器上 sqldeveloper 中的脚本 运行s
- 连接打开
- 侦听器启动并且 运行正在
- 参数'name'和'pwd'通过并发送
堆栈跟踪:
System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(OleDbHResult hr)
a következő helyen: System.Data.OleDb.OleDbCommand.ExecuteCommandTextForMultpleResults(tagDBPARAMS dbParams, Object& executeResult)
a következő helyen: System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult)
a következő helyen: System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method)
a következő helyen: System.Data.OleDb.OleDbCommand.ExecuteScalar()
a következő helyen: Tudásbázis.Bejelentkezes.BejelentkezésButton_Click(Object sender, EventArgs e) hely: D:\Repos\Tudásbázis\Tudásbázis\Bejelentkezes.cs, sor: 34
a következő helyen: System.Windows.Forms.Control.OnClick(EventArgs e)
a következő helyen: System.Windows.Forms.Button.OnClick(EventArgs e)
a következő helyen: System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
a következő helyen: System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
a következő helyen: System.Windows.Forms.Control.WndProc(Message& m)
a következő helyen: System.Windows.Forms.ButtonBase.WndProc(Message& m)
a következő helyen: System.Windows.Forms.Button.WndProc(Message& m)
a következő helyen: System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
a következő helyen: System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
a következő helyen: System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
a következő helyen: System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
a következő helyen: System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
a következő helyen: Tudásbázis.Program.Main() hely: D:\Repos\Tudásbázis\Tudásbázis\Program.cs, sor: 19
a következő helyen: System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
a következő helyen: System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
a következő helyen: Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
a következő helyen: System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
a következő helyen: System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
a következő helyen: System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
a következő helyen: System.Threading.ThreadHelper.ThreadStart()System.Data.OleDb.OleDbException (0x80004005): Meghatározatlan hiba: E_FAIL(0x80004005)
a következő helyen: System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(OleDbHResult hr)
a következő helyen: System.Data.OleDb.OleDbCommand.ExecuteCommandTextForMultpleResults(tagDBPARAMS dbParams, Object& executeResult)
a következő helyen: System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult)
a következő helyen: System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method)
a következő helyen: System.Data.OleDb.OleDbCommand.ExecuteScalar()
a következő helyen: Tudásbázis.Bejelentkezes.BejelentkezésButton_Click(Object sender, EventArgs e) hely: D:\Repos\Tudásbázis\Tudásbázis\Bejelentkezes.cs, sor: 34
a következő helyen: System.Windows.Forms.Control.OnClick(EventArgs e)
a következő helyen: System.Windows.Forms.Button.OnClick(EventArgs e)
a következő helyen: System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
a következő helyen: System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
a következő helyen: System.Windows.Forms.Control.WndProc(Message& m)
a következő helyen: System.Windows.Forms.ButtonBase.WndProc(Message& m)
a következő helyen: System.Windows.Forms.Button.WndProc(Message& m)
a következő helyen: System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
a következő helyen: System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
a következő helyen: System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
a következő helyen: System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
a következő helyen: System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
a következő helyen: Tudásbázis.Program.Main() hely: D:\Repos\Tudásbázis\Tudásbázis\Program.cs, sor: 19
a következő helyen: System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
a következő helyen: System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
a következő helyen: Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
a következő helyen: System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
a következő helyen: System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
a következő helyen: System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
a következő helyen: System.Threading.ThreadHelper.ThreadStart()
An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in System.Data.dll
Additional information: Meghatározatlan hiba: E_FAIL(0x80004005)
哪里出现错误:
using (OleDbConnection connection = new OleDbConnection(ApplicationStrings.ConnectionString))
{
using (OleDbCommand command = connection.CreateCommand())
{
connection.Open();
command.CommandText = QueryString;
command.Parameters.AddWithValue("név",NévTextBox);
command.Parameters.AddWithValue("jelszó",_jelszó);
int number = (int) command.ExecuteScalar(); //This is the line that throws the error
}
}
其中 QueryString = "SELECT COUNT(*) FROM Felhasználók WHERE név = :név AND jelszó = :jelszó;"
重音字母是否可能导致编码错误?
尝试
command.Parameters.AddWithValue("név",NévTextBox.Text);
OleDbCommand 方法 AddWithValue 接受 Object,这就是您可以将 TextBox 作为参数传递而不会出现任何编译错误的原因。
我正在尝试 运行 一个查询,连接发生了,但是当命令执行 运行s 时,我得到了上面的错误。
这是我想要的查询 运行:
SELECT COUNT(*) 来自 name = :name AND pwd = :pwd;
的用户我的连接字符串:
供应商=OraOLEDB.Oracle;用户ID = HR;密码 = hr;
规格:
- C# WinForms
- 甲骨文 11
- 使用 Oracle XE
我尝试过的步骤:
- 实时服务器上 sqldeveloper 中的脚本 运行s
- 连接打开
- 侦听器启动并且 运行正在
- 参数'name'和'pwd'通过并发送
堆栈跟踪:
System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(OleDbHResult hr) a következő helyen: System.Data.OleDb.OleDbCommand.ExecuteCommandTextForMultpleResults(tagDBPARAMS dbParams, Object& executeResult) a következő helyen: System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult) a következő helyen: System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method) a következő helyen: System.Data.OleDb.OleDbCommand.ExecuteScalar() a következő helyen: Tudásbázis.Bejelentkezes.BejelentkezésButton_Click(Object sender, EventArgs e) hely: D:\Repos\Tudásbázis\Tudásbázis\Bejelentkezes.cs, sor: 34 a következő helyen: System.Windows.Forms.Control.OnClick(EventArgs e) a következő helyen: System.Windows.Forms.Button.OnClick(EventArgs e) a következő helyen: System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) a következő helyen: System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) a következő helyen: System.Windows.Forms.Control.WndProc(Message& m) a következő helyen: System.Windows.Forms.ButtonBase.WndProc(Message& m) a következő helyen: System.Windows.Forms.Button.WndProc(Message& m) a következő helyen: System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) a következő helyen: System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg) a következő helyen: System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData) a következő helyen: System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) a következő helyen: System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) a következő helyen: Tudásbázis.Program.Main() hely: D:\Repos\Tudásbázis\Tudásbázis\Program.cs, sor: 19 a következő helyen: System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) a következő helyen: System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) a következő helyen: Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() a következő helyen: System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) a következő helyen: System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) a következő helyen: System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) a következő helyen: System.Threading.ThreadHelper.ThreadStart()System.Data.OleDb.OleDbException (0x80004005): Meghatározatlan hiba: E_FAIL(0x80004005) a következő helyen: System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(OleDbHResult hr) a következő helyen: System.Data.OleDb.OleDbCommand.ExecuteCommandTextForMultpleResults(tagDBPARAMS dbParams, Object& executeResult) a következő helyen: System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult) a következő helyen: System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method) a következő helyen: System.Data.OleDb.OleDbCommand.ExecuteScalar() a következő helyen: Tudásbázis.Bejelentkezes.BejelentkezésButton_Click(Object sender, EventArgs e) hely: D:\Repos\Tudásbázis\Tudásbázis\Bejelentkezes.cs, sor: 34 a következő helyen: System.Windows.Forms.Control.OnClick(EventArgs e) a következő helyen: System.Windows.Forms.Button.OnClick(EventArgs e) a következő helyen: System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) a következő helyen: System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) a következő helyen: System.Windows.Forms.Control.WndProc(Message& m) a következő helyen: System.Windows.Forms.ButtonBase.WndProc(Message& m) a következő helyen: System.Windows.Forms.Button.WndProc(Message& m) a következő helyen: System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) a következő helyen: System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg) a következő helyen: System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData) a következő helyen: System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) a következő helyen: System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) a következő helyen: Tudásbázis.Program.Main() hely: D:\Repos\Tudásbázis\Tudásbázis\Program.cs, sor: 19 a következő helyen: System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) a következő helyen: System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) a következő helyen: Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() a következő helyen: System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) a következő helyen: System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) a következő helyen: System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) a következő helyen: System.Threading.ThreadHelper.ThreadStart() An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in System.Data.dll Additional information: Meghatározatlan hiba: E_FAIL(0x80004005)
哪里出现错误:
using (OleDbConnection connection = new OleDbConnection(ApplicationStrings.ConnectionString)) { using (OleDbCommand command = connection.CreateCommand()) { connection.Open(); command.CommandText = QueryString; command.Parameters.AddWithValue("név",NévTextBox); command.Parameters.AddWithValue("jelszó",_jelszó); int number = (int) command.ExecuteScalar(); //This is the line that throws the error } }
其中 QueryString = "SELECT COUNT(*) FROM Felhasználók WHERE név = :név AND jelszó = :jelszó;"
重音字母是否可能导致编码错误?
尝试
command.Parameters.AddWithValue("név",NévTextBox.Text);
OleDbCommand 方法 AddWithValue 接受 Object,这就是您可以将 TextBox 作为参数传递而不会出现任何编译错误的原因。