Sample code for 30+ languages & platforms
PowerBuilder

Transition from Email.CreateDsn to Email.ToDsn

Provides instructions for replacing deprecated CreateDsn method calls with ToDsn.

Chilkat PowerBuilder Downloads

PowerBuilder
integer li_rc
integer li_Success
oleobject loo_Email
string ls_Explanation
string ls_StatusFieldsXml
integer li_HeaderOnly
oleobject loo_EmailObj
oleobject loo_DsnEmail

li_Success = 0

loo_Email = create oleobject
li_rc = loo_Email.ConnectToNewObject("Chilkat.Email")
if li_rc < 0 then
    destroy loo_Email
    MessageBox("Error","Connecting to COM object failed")
    return
end if

// ...
// ...

ls_Explanation = "..."
ls_StatusFieldsXml = "..."
li_HeaderOnly = 0

// ------------------------------------------------------------------------
// The CreateDsn method is deprecated:

loo_EmailObj = loo_Email.CreateDsn(ls_Explanation,ls_StatusFieldsXml,li_HeaderOnly)
if loo_Email.LastMethodSuccess = 0 then
    Write-Debug loo_Email.LastErrorText
    destroy loo_Email
    return
end if

// ...
// ...

destroy loo_EmailObj

// ------------------------------------------------------------------------
// Do the equivalent using ToDsn.
// Your application creates a new, empty Email object which is passed 
// in the last argument and filled upon success.

loo_DsnEmail = create oleobject
li_rc = loo_DsnEmail.ConnectToNewObject("Chilkat.Email")

li_Success = loo_Email.ToDsn(ls_Explanation,ls_StatusFieldsXml,li_HeaderOnly,loo_DsnEmail)
if li_Success = 0 then
    Write-Debug loo_Email.LastErrorText
    destroy loo_Email
    destroy loo_DsnEmail
    return
end if



destroy loo_Email
destroy loo_DsnEmail