Dim proBcpCmd As New System.Diagnostics.Process()
Dim strSql As StringBuilder = new StringBuilder("")
proBcpCmd.StartInfo.FileName = "bcp"
proBcpCmd.StartInfo.Arguments = """" & strSql.ToString & """ queryout " _
proBcpCmd.Start()
proBcpCmd.WaitForExit()
intRet = proBcpCmd.ExitCode
strDir为所写文件路径名
strDataSource为数据库名(主机ip+数据库名)
strUserId为数据库登录用户名
strPwd为数据库登录用户密码