BulkCopy问题,请各位帮忙

willway 2002-07-24 01:43:04
以下是在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,现在我想导出该表中的指定记录应当如何实现啊?
...全文
28 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
willway 2002-07-24
  • 打赏
  • 举报
回复
各位大哥帮忙啊~~~——急的很~~!!!

34,593

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧