本帖最后由 bcrun 于 2011-01-28 20:20:13 编辑

解决方案 »

  1.   

    Private Sub command1_click()
        Label4.Caption = "网站名称: " & Text2.Text
        Label5.Caption = "分类: " & Combo1.Text
        Label6.Caption = Combo2.Text
        Adodc1.RecordSource = "select   *   from   总表   where   网址   = '" & Text1.Text & "' "
        Adodc1.Refresh
        
        If Adodc1.Recordset.RecordCount > 0 Then
            Text2.Text = ""
            MsgBox "存在"
            Label7.Caption = ""
        Else
            conn.Execute "insert   into   生活服务   (分类,网址,名称,备注1,备注2,备注3,备注4)   values   ( '" & Combo2.Text & "', '" & Text1.Text & "', '" & Text2.Text & "', '" & Text3.Text & "', '" & Text4.Text & "', '" & Text5.Text & "', '" & Text6.Text & "') "
            conn.Execute "insert   into   总表   (分类,网址,名称,备注1,备注2,备注3,备注4)   values   ( '" & Combo2.Text & "', '" & Text1.Text & "', '" & Text2.Text & "', '" & Text3.Text & "', '" & Text4.Text & "', '" & Text5.Text & "', '" & Text6.Text & "') "
            
            Label7.Caption = "信息写入成功"
            Text1.Text = ""
            Text2.Text = ""
            Text3.Text = ""
            Text4.Text = ""
            Text5.Text = ""
            Text6.Text = ""
        End If
    End Sub
      

  2.   

    去掉了好多空格,lz不应该的空格太多了Adodc1.Recordset.Update 这句没用
      

  3.   

    lz的conn引用了吗?定义了吗?
      

  4.   

    conn.execute "insert into 表名(字符型字段,数值型字段) values('"& 字符型变量 &"',"& 数值型变量 &")"
      

  5.   

    数据可能已经写入,ADODC和ADODB混用时,ADODC要延时重新查询。如果是conn..Execute...无法写入数据库,会有报错指明原因,按错误原因修改也就是了。建议不要ADODC与ADODB混用,只要其中一个就能完成所有任务。
      

  6.   

    Adodc1.RecordSource = "select * from 总表 where 网址 = '" & Text1.Text & "' "这句还是提示事实错误:“424”
    要求对象
      

  7.   

    你窗体上没有Adodc1或Text1引起的