火大了!今天贴了三个帖子一个都没有回复,高手今天都休息吗?

willway 2002-07-24 04:15:24
用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,现在我想导出该表中的指定记录应当如何实现啊?
...全文
65 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
zergs 2002-07-24
  • 打赏
  • 举报
回复
up
zjaloe 2002-07-24
  • 打赏
  • 举报
回复
不好意思,我不会,

7,763

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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