Dim adoConn As New ADODB.Connection
Dim adoComm As New ADODB.Command
Dim adoRes As New ADODB.Recordset
Private Form_Load()
adoConn.Open "......." 'Insert Dsn
Set adoComm = adoConn
adoComm.CommandText = "Select * from ......."
adoRes.CursorLocation = adUseClient
adoRes.Open adoComm, , adOpenStatic, adLockBatchOptimistic
'To update New Records..
adoRes.Addnew
.
.
.
adores.UpdateBatch
End Sub好好看看书。
MSDN

解决方案 »

  1.   

    Dim adoConn As New ADODB.Connection
    Dim adoComm As New ADODB.Command
    Dim adoRes As New ADODB.Recordset
    Private Form_Load()
    adoConn.Open "......." 'Insert Dsn
    Set adoComma.ActionConnection = adoConn
    adoComm.CommandText = "Select * from ......."
    adoRes=adoComm.Exceute
    adores.UpdateBatch
    End Sub
      

  2.   

    去看看MSDN吧,讲得很清楚!我很奇怪,为什么很多人多不看MSDN。
      

  3.   

    thank国庆快乐!身体康健,财源广进,一切顺心......
      

  4.   

    SQL Server:
    DSNLess Use ODBCPrivate Function ConnectSQLServer(ByVal ServerName As String, ByVal DataBase As String, ByVal UID As String, ByVal PWD As String, ByVal Timeout As Integer) As Boolean
          
        Dim strConnect As String
          
        On Error GoTo Error_ConnectServer
        
        cn.CursorLocation = adUseClient
        strConnect = "Driver={SQL Server};Server=" & ServerName & ";DataBase=" & DataBase & ";UID=" & UID & ";PWD=" & PWD & ";"
        cn.ConnectionString = strConnect
        cn.ConnectionTimeout = Timeout
        cn.Open
        
        ConnectSQLServer = True
        Exit Function
        
    Error_ConnectServer:
        ConnectSQLServer = FalseEnd Function