本帖最后由 作者 于 2007-10-23 12:58:06 编辑
程序报错 实时错误[Microsoft][ODBC 驱动程序管理器]未发现数据源名称并且未指定默认驱动程序 程序出错的位置 sjklj = "Provider=MSDASQL.1ersist Security Info=False;Data Source=hbcad" sjk.Open sjklj------------------------------错在这里 连接库Data Source=hbcad?????????????????
--------------------- Private Sub UserForm_Layout() Dim sjk As New ADODB.Connection Dim sjklj As String Dim dwzd As New ADODB.Recordset Dim dwjs As Double Dim zd() As String sjklj = "Provider=MSDASQL.1ersist Security Info=False;Data Source=hbcad" sjk.Open sjklj dwzd.Open "select aa=count(dwid) from tyname", sjk, adOpenDynamic, adLockBatchOptimistic If Not dwzd.EOF Then dwjs = dwzd.Fields("aa") End If dwzd.Close dwzd.Open "select * from tyname", sjk, adOpenDynamic, adLockBatchOptimistic ReDim zd(dwjs) As String i = 0 Do While Not dwzd.EOF i = i + 1 zd(i) = dwzd.Fields("dwname") dwzd.MoveNext Loop For j = 0 To i ListBox1.List(j) = zd(j + 1) '此处总是提示“无法获取list属性、属性阵列索引无效 Next j End Sub |