我第一次用组件开发网站,遇到最大的问题就是数据库连接的问题,连接总是会被其它的访问者关闭,我觉得不同的进程是不会相互干扰的,你们遇到什么棘手的问题吗
,大家讨论一下吧
,大家讨论一下吧
解决方案 »
- 請看內容,能否實現?
- 印度的软件巨头用Microsoft Dynamics Ax开发ERP
- vb怎么把不同表里同一个人的数据读取出来?
- ***求知识****VB生成的输出DLL中的函数调用
- 为什么从pop3接受邮件,有时候一封邮件会被分成2个文件存在本地硬盘上。(附代码)
- 什么时候升的星啊!支持VB.
- 高分求软键盘原码,急
- vb中没有指针,那么怎么样才能访问vc中的指针中的内容呢!
- 紧急求助!!!!需要一个打印功能的原代码.
- MSHFlexGrid改变列的宽度,激活那个事件?MSHFlexGrid能动态添加行吗?
- 高分请教请问如何在vb中用代码设定计算机区域设置当中的时间格式为长时间格式
- 进程内组件怎么把它配置为DCOM进行远程调用,急!
ADODB.Connection error '800a0e78' 对象关闭时,不允许操作。 /inc/counthouse.asp, line 35 类似的错误,而且这个错误非常隐蔽,一刷新就不见了我到现在还没有搞定这个问题!
Private mServerName As String
Private mDBName As String
Private mUserName As String
Private mTimeout As Integer
Private mIsopen As Boolean
Public g_Cnn As New Connection
Public Property Let ServerName(ByVal vData As String)
mServerName = vData
End PropertyPublic Property Let DBName(ByVal vData As String)
mDBName = vData
End PropertyPublic Property Let UserName(ByVal vData As String)
mUserName = vData
End PropertyPublic Property Let Timeout(ByVal vData As Integer)
mTimeout = vData
End PropertyPublic Property Get Isopen() As Boolean
Isopen = mIsopen
End PropertyPublic Function Cnn_DB() As Boolean
'On Error GoTo ErrPlc1
'On Error Resume Next
Const strPwd = "xxxxxxx"
g_Cnn.CursorLocation = adUseClient
g_Cnn.CommandTimeout = mTimeout
g_Cnn.ConnectionString = "Provider=SQLOLEDB.1;Persist Security Info=True;User ID=" _
& mUserName & ";Initial Catalog=" & mDBName & ";Data Source=" _
& mServerName & ";pwd=" & strPwd
g_Cnn.Open
'Call sound(1)
Cnn_DB = True
'Exit Function
'
'ErrPlc1:
'
' If Err.Number = 3705 Then
' g_Cnn.Close
' g_Cnn.Open
' Cnn_DB = True
' 'Beep
' Else
' Cnn_DB = False
' End If
End FunctionPublic Function Close_DB() As Boolean
''On Error GoTo ErrPlc2
'On Error Resume Next
' g_Cnn.Close
' Set g_Cnn = Nothing
' 'Call sound(2)
' Close_DB = True
If g_Cnn.State <> 0 Then
g_Cnn.Close
Set g_Cnn = Nothing
End IfEnd Function
这种方式看看这个我倒没有想过