Skip to Content
author's profile photo Former Member
Former Member

PB Newbie - INI file


Hi PB gurus!

How does an an ini file work to store/use database, server name, etc.?

Thanks in advance,

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • Best Answer
    Posted on Feb 18, 2016 at 04:50 PM

    Create a new target of type "Template application".

    This will generate some basic code and classes.

    The generated connection service class shows how to read connection properties from various sources.

    hth

    Arnd

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 18, 2016 at 03:22 AM

    Use the ProfileString function to retrieve values from the file and SetProfileString to set values.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 18, 2016 at 03:39 AM

    Hi Ryan;

    In addition to what Roland said, there is also the Get/SetProfileInt() methods as well to assist you in interoperating with INI files. The key thing to remember when creating INI files with newer PB & O/S versions is that they are expected to be Unicode. So if your using Notepad for example, make sure when you do a SaveAs that you select the Unicode format in the save dialog.

    For a good example of INI file use, have a look at my example OrderEntry application built from the STD Foundation Class framework. The entire PB framework is INI file driven. The INI approach works for native PB, .Net, Web & Mobile deployed applications from PowerBuilder.

    FYI: OrderEntry

    HTH

    Regards ... Chris

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Feb 27, 2016 at 04:44 PM

    If one of the things you need to store in the INI file is a password for access to the DB, you should probably not store it as clear text, but encrypt it with a reversible encryption.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 28, 2016 at 08:05 AM

    Hi Roland/Cris,

    Another issue here. I get the source from Roland regarding the Encryption and decryption. No issue on that, my problem is in the setprofilestring and profilestring. I cannot get the exact value from the ini. Let us take this as sample, I encrypted a password let say the encrypted value is "xxdal aldkfj " and it was saved just same (without the double quote). But when I try to login again I will use profilestring to get that password and I only got "xxdal" remaining value was not being captured making it as invalid password when I tried to decrypt. Is this a bug in 12.6 build 3506? Should I go for build 4088?

    Regards,

    Elena

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.