Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2009
    Posts
    1

    Unanswered: can't connect to db

    hi every one
    i'm a beginning with power builder 11
    it's my frist time to create webform with power builder
    i make my frist window(w_main) and i can't connect to my database (sqlanywhere)

    i write this code in open event of the app

    SQLCA.DBMS = "ODBC"
    SQLCA.AutoCommit = false
    SQLCA.DBParm = "ConnectString='DSN=DB;UID=admin;PWD=1234567'"

    CONNECT ;
    open(w_main)

    but do nothing

    the error is "transaction not connected"

    need help please ??
    Last edited by gabalawy; 07-10-09 at 15:55.

  2. #2
    Join Date
    Jun 2009
    Location
    South Africa
    Posts
    33
    You might be missing this code in the open event :

    // Connect Transaction Object.

    connect using SQLCA;
    if SQLCA.SQLCode <> 0 then
    MessageBox ( "Error", &
    "Connect SQLCode = " &
    + string ( SQLCA.SQLCode ) )
    halt close
    end if


    At the same token, you might want to add this to the app or main window's "close" event as well :
    // Disconnect Transaction Object.

    disconnect using SQLCA;
    if SQLCA.SQLCode <> 0 then
    MessageBox ( "Error", &
    "Disconnect SQLCode = " &
    + string ( SQLCA.SQLCode ) )
    return -1
    end if

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •