Thank a lot.
I have 2 questions:
1. this is my current code and work fine, but I need that the user have posibility to choice a path for save the text file, I mean, how I do for the user can choice a drive and path for save your text file?
this is my current code:
Private Sub ExportarPedidos()
Dim cn As New SqlConnection
Dim query As New SqlCommand
cn.ConnectionString = SDSPedidos.ConnectionString
cn.Open()
query.Connection = cn
query.CommandType = Data.CommandType.StoredProcedure
query.CommandText = "ExportarPedidos"
query.ExecuteNonQuery()
cn.Close()
End Sub
Store Procedure "ExportarPedidos":
declare @sql varchar(8000)
SELECT @sql = 'bcp "select * from InterfaceSM.dbo.PedidosAExportar" queryout D:\temp\Pedidos.prn -c -t, -T -S Server123\SQLEXPRESS1'
exec InterfaceSM..xp_cmdshell @sql
My second question is:
Go to the complete details ...