Asking for help!! Open connection via WinSCP in Powerbuilder10.
This is my Code :
integer li_err,li_err2
oleobject lo_SessionOptions, lo_Session, lo_remoteDirectoryInfo, lo_TransferOperationResult, lo_TransferOptions,lo_Protocol
TRY
lo_SessionOptions = create oleobject
li_err = lo_SessionOptions.connecttonewobject("WinSCP.SessionOptions")
lo_sessionOptions.Protocol = 2
lo_SessionOptions.HostName = "192.168.1.50"
lo_SessionOptions.UserName = "ftp_user"
lo_SessionOptions.Password = "123456"
lo_SessionOptions.PortNumber = 21
lo_SessionOptions.FtpMode = 0
lo_Session = create oleobject
li_err2 = lo_Session.connecttonewobject("WinSCP.Session")
if lo_Session.Opened then
lo_Session.Abort()
end if
lo_Session.Open(lo_SessionOptions)
CATCH (OLERuntimeError exRuntime)
messagebox("error",string(exRuntime))
END TRYThere are two problem that I've got.
First is the propertise of SessionOptions Protocol. I know that document say that the value will be something like Protocol.Sftp or Protocol.ftp. but I can't make powerbuilder recognize type protocol, so I set it to integer value 2(
assuming it's start from 0). How can i set this propertise?
Second is I get the error when running open method. The error just says "Error calling external object function open at line xx in clicked event .....", and OLERuntimeError exRuntime is always null.
p.s I've already Registry the dll. the li_err when connecttonewobject is 0.
Can anyone help me? Thanks a lot!!
tiver109, 20180604