可以直接用ADO.RecoedSet的Save方法保存啊 Saves (persists) the Recordset in a file. Syntaxrecordset.Save FileName, PersistFormat ParametersFileName Optional. Complete path name of the file where the Recordset is to be saved.PersistFormat Optional. A PersistFormatEnum value that specifies the format in which the Recordset is to be saved. Can be one of the following constants.Constant Description adPersistADTG (Default) Save in proprietary Advanced Data Tablegram format. adPersistXML Save in XML format.
试试:exec master..xp_cmdshell 'bcp "库名..表名" out "d:\ret.csv" -c -t ,-U sa -P password'
Saves (persists) the Recordset in a file. Syntaxrecordset.Save FileName, PersistFormat ParametersFileName Optional. Complete path name of the file where the Recordset is to be saved.PersistFormat Optional. A PersistFormatEnum value that specifies the format in which the Recordset is to be saved. Can be one of the following constants.Constant Description
adPersistADTG (Default) Save in proprietary Advanced Data Tablegram format.
adPersistXML Save in XML format.
strPutOutSQL = "Select * Into " & strFileName & " From " & strPutOutTable & _
" IN[ODBC][ODBC;Driver=SQL Server;UID=sa;PWD=" & PASSWORD & ";" & _ "Server=" & gServerIP & ";" & _
"DataBase=" & DATA_BASE_NAME & ";]"
conY.Execute strPutOutSQL但有一个问题:如果导入的数据保存路径在数据库服务器上,没有问题;但如果在客户端运行程序并从服务器导数据在客户端机子上出现问题,该问题如何解答?望经验者告知!!