新人求助,vb导出数据库某张表至文本文件
本人刚接触vb,求高手 vb连接局域网sql 2000导出指定数据库某张表至文本文件 本机可以实现,局域网不知道怎么搞定 Dim myCnn As New ADODB.Connection
Dim srvname As String
Dim suid As String
Dim pwd As String
Dim smsdb As String
srvname = Combo2.Text
suid = Text1.Text
pwd = Text2.Text
smsdb = Combo1.Text
myStr = "Provider=SQLOLEDB.1;Password=" & pwd & ";Persist Security Info=True;User ID=" & suid & ";Initial Catalog=" & smsdb & ";Data Source = " & srvname
myCnn.ConnectionString = myStr
myCnn.Open
myCnn.Execute "EXEC master..xp_cmdshell 'bcp 数据库名..表名 out d:\out.txt -c -S服务器名 -U用户名 -P密码'"
myCnn.Close
Set myCnn = Nothing
[ 本帖最后由 zhl4756 于 2012-11-24 16:43 编辑 ]