Unhandled Access Violation Reading 0xb0020a0 Exception at 6512be63h
CAD2006 VBA程序运行时老是出现 Unhandled Access Violation Reading 0xb0020a0 Exception at 6512be63h错误,不知道是什么原因。有时候会在VBA程序第一次启动时出现,有时会是在VBA程序重复运行 3、4次时出现。CAD2006 VBA程序运行时老是出现 Unhandled Access Violation Reading 0xb0020a0 Exception at 6512be63h错误,不知道是什么原因。有时候会在VBA程序第一次启动时出现,有时会是在VBA程序重复运行 3、4次时出现。 <p>我好象发现是什么原因引起了,应该是我在一个模块中执行过一次读写数据库后,再在另一模块中执行读写数据库的操作就会出现上述错误,可每次执行完读取数据库,我都会把记录集关闭的。这是为什么呢?</p><p>为什么没有人回答呢?没有人遇到过这种问题吗?</p> 程序没见到,看不到问题在哪里。你应该放上出错的程序,并指出在哪一行出错的。 根本就不知道是那一行出的问题,就是我运行完一个宏,再运行另一个宏时,直接就出上述错误,然后退出。 象这种不稳定的情况,可重新安装一次AutoCAD试试。 我怀疑是不是ADODC控件引起的?应该是访问数据库引起的问题。可我不知道到底错在什么地方! 访问数据库,如果不需要显示在对话框中的数据库列表控制,则直接用程序搞掂好了,不要引用adodc控件。 问题还是依旧,我搞不明白了!!!!!!!郁闷中!!!! 用ADO对象试试Public Function OpenConnForAccess(ByVal FileName As String) As ADODB.Connection
Dim AdoConn As New ADODB.Connection
With AdoConn
.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & FileName & ";Persist Security Info=False"
.Open
End With
Set OpenConnForAccess = AdoConn
End Function
Public Function OpenConnForSqlServer(ByVal ServerName As String, ByVal UserId As String, ByVal PassWord As String, Optional ByVal DateBaseName As String = "") As ADODB.Connection
Dim AdoConn As New ADODB.Connection
Dim strConn As String
With AdoConn
strConn = "Provider=SQLOLEDB.1;Persist Security Info=True;User ID=" & UserId & ";Password=" & PassWord & ";Data Source=" & ServerName
If DateBaseName <> "" Then strConn = strConn & ";database=" & DateBaseName
.ConnectionString = strConn
.Open
End With
Set OpenConnForSqlServer = AdoConn
End Function
Public Function OpenConnForSqlServerByWin(ByVal ServerName As String, Optional ByVal DateBaseName As String = "") As ADODB.Connection
Dim AdoConn As New ADODB.Connection
Dim strConn As String
With AdoConn
strSql = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Data Source=" & ServerName
If DateBaseName <> "" Then strConn = strConn & ";Initial Catalog=" & DateBaseName
.ConnectionString = strConn
.Open
End With
Set OpenConnForSqlServerByWin = AdoConn
End Function
Public Function OpenConnForOracle(ByVal ServerName As String, ByVal UserId As String, ByVal PassWord As String) As ADODB.Connection
Dim AdoConn As New ADODB.Connection
With AdoConn
.ConnectionString = "Provider=MSDAORA.1;User ID=" & UserId & ";Password=" & PassWord & ";Persist Security Info=True;"
.Open
End With
Set OpenConnForOracle = AdoConn
End Function
Public Function OpenRecordset(ByVal strSql As String, ByVal AdoConn As ADODB.Connection) As ADODB.Recordset
Dim rs As New ADODB.Recordset
With rs
.CursorLocation = adUseClient
.CursorType = adOpenDynamic
.Open strSql, AdoConn, , , adCmdText
End With
Set OpenRecordset = rs
End Function
Public Function RunTrans(ByVal tranSql As String, ByVal AdoConn As ADODB.Connection)
With AdoConn
.BeginTrans
.Execute tranSql
.CommitTrans
End With
End Function
'strSql = "create table mytab1 (" & _
' "Id Counter primary key," & _
' "Name string(20) not null," & _
' " real," & _
' "Age int default 0," & _
' " DateTime);"
'RunTrans conn, strSql
页:
[1]