Have a program in OE11.7 accessing MsSql database with .Net components. Need to do the same in OE10.2b. Is it possible? - Forum - OpenEdge Development - Progress Community

Have a program in OE11.7 accessing MsSql database with .Net components. Need to do the same in OE10.2b. Is it possible?

 Forum

Have a program in OE11.7 accessing MsSql database with .Net components. Need to do the same in OE10.2b. Is it possible?

This question is not answered

Have a program developen in OE 11.7. Reading and updateing a MsSql database for ABL using .Net components. Trying to run it under OE10.2b  and get an error message:.

Invalid datatype specified SqlCredentials. Spesify a datatype ...(5638).

How can i do this in OE 10.2b?

In the definition block:

------------------------------

USING Progress.Lang.*.
USING System.Data.*.
USING System.Data.SqlClient.*.

DEFINE VARIABLE SqlCred AS SqlCredential NO-UNDO.

And the method using the variable.

/*------------------------------------------------------------------------------
Purpose:
Notes:
------------------------------------------------------------------------------*/

METHOD PUBLIC LOGICAL oppkoblingSqlServer( ):

DEFINE VARIABLE result AS LOGICAL NO-UNDO.
result = FALSE.

/* passord -> sec.string */
SeqString = NEW System.Security.SecureString().
DO ix = 1 TO LENGTH(cPwd):
SeqString:AppendChar(SUBSTR(cPwd,ix,1)).
END.
SeqString:MakeReadOnly().

/* brukernavn, pwd */
SqlCred = NEW SqlCredential(cUserId,SeqString).

ConString = "Server=" + cServer + ",1433".
ConString = ConString + ";Database=" + cDbName .

Conn = NEW SqlConnection(ConString,SqlCred).

Conn:Open() NO-ERROR.
IF ERROR-STATUS:ERROR THEN
DO:
rStandardFunksjoner:SkrivTilLogg(cLogg,
' ' + ERROR-STATUS:GET-MESSAGE(1)
).
END.
ELSE
DO:
rStandardFunksjoner:SkrivTilLogg(cLogg,
' Oppkoblet mot Sql server: ' + ConString + '.'
).
result = TRUE.
END.

CmdRead = NEW SqlCommand('', Conn).

RETURN result.

END METHOD.

All Replies
  • 10.2B is using .NET 2.0; 11.x is using .NET 4.x. so you may have to update your Assembly references.

    Sent from Nine

    Von: noekleb <bounce-noekleb@community.progress.com>
    Gesendet: Montag, 12. Februar 2018 17:36
    An: TU.OE.Development@community.progress.com
    Betreff: [Technical Users - OE Development] Have a program in OE11.7 accessing MsSql database with .Net components. Need to do the same in OE10.2b. Is it possible?

    Update from Progress Community
    noekleb

    Have a program developen in OE 11.7. Reading and updateing a MsSql database for ABL using .Net components. Trying to run it under OE10.2b  and get an error message:.

    Invalid datatype specified SqlCredentials. Spesify a datatype ...(5638).

    How can i do this in OE 10.2b?

    In the definition block:

    ------------------------------

    USING Progress.Lang.*.
    USING System.Data.*.
    USING System.Data.SqlClient.*.

    DEFINE VARIABLE SqlCred AS SqlCredential NO-UNDO.

    And the method using the variable.

    /*------------------------------------------------------------------------------
    Purpose:
    Notes:
    ------------------------------------------------------------------------------*/

    METHOD PUBLIC LOGICAL oppkoblingSqlServer( ):

    DEFINE VARIABLE result AS LOGICAL NO-UNDO.
    result = FALSE.

    /* passord -> sec.string */
    SeqString = NEW System.Security.SecureString().
    DO ix = 1 TO LENGTH(cPwd):
    SeqString:AppendChar(SUBSTR(cPwd,ix,1)).
    END.
    SeqString:MakeReadOnly().

    /* brukernavn, pwd */
    SqlCred = NEW SqlCredential(cUserId,SeqString).

    ConString = "Server=" + cServer + ",1433".
    ConString = ConString + ";Database=" + cDbName .

    Conn = NEW SqlConnection(ConString,SqlCred).

    Conn:Open() NO-ERROR.
    IF ERROR-STATUS:ERROR THEN
    DO:
    rStandardFunksjoner:SkrivTilLogg(cLogg,
    ' ' + ERROR-STATUS:GET-MESSAGE(1)
    ).
    END.
    ELSE
    DO:
    rStandardFunksjoner:SkrivTilLogg(cLogg,
    ' Oppkoblet mot Sql server: ' + ConString + '.'
    ).
    result = TRUE.
    END.

    CmdRead = NEW SqlCommand('', Conn).

    RETURN result.

    END METHOD.

    View online

     

    You received this notification because you subscribed to the forum.  To stop receiving updates from only this thread, go here.

    Flag this post as spam/abuse.

    Architect of the SmartComponent Library and WinKit

    Consultingwerk Ltd.