RESPONDER UNA PREGUNTA

Si para responder la pregunta, crees necesario enviar un archivo adjunto, puedes hacerlo a traves del correo [email protected]

    Pregunta:  20187 - UNABLE TO OPEN BCP HOST DATA FILE
Autor:  Karina Gámez
Hola,

Estoy manejando una interfaz en la cual pretendo seleccionar un archivo txt delimitado por pipes ya sea de cualquier drive existente.
Y lo quiero importar o exportar a una tabla de "x" base dedatos, el codigo es el siguiente:
Set objBCP = New SQLDMO.BulkCopy
Set objServer = New SQLDMO.SQLServer
Set objDB = New SQLDMO.Database

If exporta.Value = False And Dir(selectedFile) = "" Then Exit Sub
On Error GoTo ErrorHandler

With objServer
.EnableBcp = True
.LoginSecure = True
.Connect ServerName, UserName, Password
End With
Set objDB = objServer.Databases(DatabaseName)

With objBCP
.ColumnDelimiter = "|"
.DataFilePath = selectedFile
.DataFileType = SQLDMODataFile_NativeFormat
.UseBulkCopyOption = True
.UseExistingConnection = True
End With

-----

Pero marca un error de "unable to open bcp host data file"

Alguien me puede ayudar?

Saludos y GRacias


Nombre
Apellidos
Correo
Comentarios