VB.NET中调用bcp代码

来源:互联网 发布:监控分布图制作软件 编辑:程序博客网 时间:2024/05/16 14:11

Dim proBcpCmd As New System.Diagnostics.Process()   

Dim strSql As StringBuilder = new StringBuilder("")


proBcpCmd.StartInfo.FileName = "bcp"

proBcpCmd.StartInfo.Arguments = """" & strSql.ToString & """ queryout " _

                & strDir & " -c -S " & strDataSource & " -U " & strUserId & " -P " & strPwd & " -t " & "," & ""
proBcpCmd.Start()

proBcpCmd.WaitForExit()

intRet = proBcpCmd.ExitCode


strDir为所写文件路径名

strDataSource为数据库名(主机ip+数据库名)

strUserId为数据库登录用户名

strPwd为数据库登录用户密码

0 0
原创粉丝点击