在现有的vb和oracle连接中,它显示详细信息错误而不进行处理
ORA-00907: missing right parenthesis
ORA-06512: at "SYS.DBMS_SYS_SQL", line 826
ORA-06512: at "SYS.DBMS_SQL", line 32
ORA-06512: at "EST.D_SQL", line 13
ORA-06512: at "EST.P_VAL_C", line 512
ORA-06512: at "EST.P_EST_MAIN", line 29
ORA-06512: at "EST.P_EST_C", line 31
ORA-06512: at line 2
但是在将Oracle数据库迁移到SQL Server 2016后,在VB 6.0应用程序中面临问题,即后端存储过程中发生某种错误,该错误不会显示在前端应用程序中,这是使用连接的驱动程序的问题,
否则In sql server & VB 6.0 application using : Provider='sqloledb'
In oracle & VB 6.0 application using : Provider=MSDASQL' DSN Connection
in some procedure if i execute procedure in SSMS it's showing error like
> Msg 8114, Level 16, State 5, Procedure p1no, Line 14 [Batch Start Line 45]
Error converting data type varchar to numeric.
but in vb application when i execute from front end showing like given below and not showing main procedure or sub procedure name and line no.
> Run-time error -2147xxxxxxx
> Error converting data type varchar to numeric.
请帮忙
VB6的错误处理不会转发SQL Server错误的详细信息,它只为您提供HRESULT(-2147...
号(和人类可读的错误消息。
若要从 VB6(和 VBA,以及在一定程度上 VBScript(中的 SQL Server 错误中获取更多详细信息,请遵循以下文章:
https://support.microsoft.com/en-us/help/167957/info-extracting-error-information-from-ado-in-vb
从 VB 中的 ADO 中提取错误信息
使用ADODB.Connection
对象的.Errors
集合。
VB6 不支持try/catch/finally
但它确实有On Error Goto...
就足够了:
' Ensure ADO is a referenced library instead of using late-bound objects.
Sub RunMe()
Dim c As Connection
Set c = New Connection()
On Error GoTo CatchAdoError ' This is roughly equivalent to a `try` statement, except much worse.
c.ConnectionString = "..."
Call DoSomething c
' No error happened, so return immediately so execution doesn't enter the `CatchAdoError` label's block
Exit Sub
CatchAdoError:
' Iterate through the error details:
Dim errorDetails As String
errorDetails = ""
For Each adoError In c.Errors
errorDetails = errorDetails adoError.Description & vbCrLf
errorDetails = errorDetails adoError.Source & vbCrLf & vbCrLf
Next
Call MsgBox errorDetails
End Sub
Sub DoSomething( c As Connection )
' Your main logic goes here
End Sub