我主要有两个地方不明白。
1)如何连接SQL SERVER。我的机器名是“LI”,数据库名“HK”,表名“Temp”。
2)如何运行SQL语句?例如要运行“Insert into Temp (Desc,Cont) values("description","Content")”谢谢。

解决方案 »

  1.   

    还是你啊!在我上一个回复中将strSQL的值改为"insert into temp values('description','Content')
    并将后边的RS.close取掉,就可以了
      

  2.   

    楼上这位大哥,“strConnstring = "driver={SQL Server};" & _
                 "server=" & LI & ";uid="";pwd="";database="HK"”字体是红色,是不是有错啊。
      

  3.   

    不好意思,这样看看
             strConnstring = "driver={SQL Server};" & _
                 "server=" & LI & ";uid="";pwd="";database=PMis"
      

  4.   

    '連接SQL SERVER
    private sub form_load()
    dim g_cn As New ADODB.Connection  
    dim strsql as string
    If g_cn.State = adStateOpen Then g_cn.Close
    With g_cn
          .Provider = "sqloledb"
          .ConnectionString = "data source=L1;initial catalog=HK;user id=sa;password="
          .Open
    End With
    strsql="Insert into Temp (Desc,Cont) values('description','Content')"
    '插入新數據
    g_cn.execute(strsql)
    end sub
      

  5.   

    补充
    string ="Insert into Temp (Desc,Cont) values("description","Content")""