再问关于数据连接!!!
下面是我的数据连接 代码,用的是 Public gCnn As New ADODB.Connection
DataServConn = "PROVIDER=MSDASQL;Driver={SQL Server};Server=local;UID=sa;PWD=123;Database=Data1;"
gCnn.CursorLocation = ADODB.CursorLocationEnum.adUseClient
gCnn.Open(DataServConn)
Dim sqlstr1
sqlstr1 = "select * from table"
datacnn.Open(sqlstr1, gCnn, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockOptimistic)
一运行出现下面的错误:“
未处理的“System.Runtime.InteropServices.COMException”类型的异常出现在 牧场管理系统.exe 中。
其他信息: 在此环境中不允许操作。
”
错误指在“ datacnn.Open(sqlstr1, gCnn, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockOptimistic)
”
请问这是怎么回事?