- 积分
- 984
- 明经币
- 个
- 注册时间
- 2005-1-5
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
楼主 |
发表于 2005-4-7 11:08:00
|
显示全部楼层
看看这段程序为什么有问题啊?(ADODC连接数据库)
Public Function myAdodcRecordSet(Optional ByVal MyTable As String = "HB589", Optional ByVal MyFields As String = "", Optional ByVal MySQLCondition1 As String = "", Optional ByVal MyDatabase As String = "HB.mdb") As Recordset Dim MyRs As ADODB.Recordset Dim myCnn As ADODB.Connection Dim MyConnectString As String Dim sql As String MsgBox GDesign MyConnectString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " & GDesignBin & "\" & MyDatabase & "ersist Security Info=False" Set myCnn = New ADODB.Connection myCnn.Open MyConnectString ''建立RecordSet Set MyRs = New ADODB.Recordset sql = "SELECT " & MyFields & " FROM " & MyTable & MySQLCondition1 MyRs.CursorLocation = adUseClient MyRs.LockType = adLockBatchOptimistic MyRs.CursorType = adOpenKeyset ''给函数赋值 MyRs.Open sql, myCnn Set myAdodcRecordSet = MyRs Set myCnn = Nothing End Function
Private Sub UserForm_Initialize()
下面这一句报错. MSFG.DataSource = myAdodcRecordSet("HB589", "d,H") End Sub
而且我的程序里面全局字符串(AutoCAD启动时自动加载设置)开始有用,后来为空,这是什么原因啊? |
|