用object.ExportData( BulkCopy ) 导出数据,object只能是表名吗?如果我想导出该表中的指定的那些记录,该怎么实现???
以下是在vb中写的程序:
Public Sub Command1_Click()
Dim oServer As New SQLDMO.SQLServer
Dim oDatabase As New Database
Dim oBCP As New SQLDMO.BulkCopy
Dim vbComma
Dim nRows As Long
Dim t As Table
oServer.EnableBcp = True
oServer.Connect "servername", "user", "password"
Set oDatabase = oServer.Databases(Text1.Text)
oBCP.ColumnDelimiter = vbComma
oBCP.DataFileType = SQLDMODataFile_CommaDelimitedChar
oBCP.ImportRowsPerBatch = 1000
oBCP.MaximumErrorsBeforeAbort = 1
oBCP.RowDelimiter = vbCrLf
oBCP.ServerBCPDataFileType = SQLDMOBCPDataFile_Char
oBCP.UseExistingConnection = True
For Each t In oDatabase.Tables
If t.Name = Text2.Text Then
      If t.SystemObject = False Then
            oBCP.DataFilePath = Text3.Text & "\" & t.Name & ".csv"
            nRows = t.ExportData(oBCP)
            MsgBox nRows & " rows exported from " & t.Name
      End If
End If
Next
oServer.DisConnect
oServer.Close
End Sub
上面的程序指定了表名t.Name = Text2.Text,现在我想导出该表中的指定记录应当如何实现啊?