是因为你用到ado了
你只需要在工程/引用 miscrosoft Activex data objects 2.x library 就可以了

解决方案 »

  1.   

    在工程引用中中添加引用
    microsoft activex data objects 引用
    就行了
      

  2.   

    Private Sub Command1_Click()Dim cn As ADODB.Connection
    Dim res As ADODB.Recordset
    Dim StrSQL As String
    Set cn = New ADODB.Connection
    Set res = New ADODB.Recordset
    cn.ConnectionString = "Provider=MSDASQL.1;Persist Security Info=False;User ID=sa;Data Source=lzy;Initial Catalog=lzy"
    cn.Open
    StrSQL = "select * from cs"
    res.Open StrSQL, cn, adOpenKeyset, adLockOptimistic
    res.AddNew
    res.Fields(0) = Now
    res.Fields(1) = 20
    res.Fields(2) = 13res.Update
    res.Close
    Set res = Nothing
    Set cn = Nothing
    请教给位高手,我要是想添加10行3列的数据应该怎么编写代码,我这个代码只能填写1行3列的数据,请教各位了
      

  3.   

    用for i=1 to 30循环添加就行了啊..
      

  4.   

    用一个循环,遍历10次。或者使用如下语句放弃AddNew
    用10条
    Insert into 表(字段1,字段2,字段3) Values (值1,值2,值3)
    来写入数据。
      

  5.   

    楼上的能不能具体点,把For循环语句能写全吗?一共是10行3列,这3列的名称分别是时间、名称、值,请教给位了
      

  6.   

    请教各位高手怎么用For循环去换行,我不知道列用什么表示
      

  7.   

    for i= 1 to 10 
        with res
        .AddNew
        .Fields(0) = Now
        .Fields(1) = 20
        .Fields(2) = 13
        .Update
        end if
    next
      

  8.   

    for i= 1 to 10 
        with res
        .AddNew
        .Fields(0) = Now
        .Fields(1) = 20
        .Fields(2) = 13
        .Update
        end with
    next
    上面打错了 把"if" 改成 “with”
      

  9.   

    for i= 1 to 10 
        with res
        .AddNew
        .Fields(0) = Now
        .Fields(1) = 20
        .Fields(2) = 13
        .Update
        end with
    next作个重复循环就行了