Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Linking a database to a MemoBox(C++)

  • 12-04-2003 2:38pm
    #1
    Closed Accounts Posts: 6


    Hi all,
    I have a memobox with a letter, including the field headings such as <Name1>, <Name2> etc
    I want to link these field names with a database called "Maildata.mdb".
    I have already created the database with the same field headings.
    I want to replace <Name1>, <Name2> etc in the memobox with the data contained in the database.

    File *in;

    in = fopen("MailData.mdb","r");

    if(Form1->Memo1->SelText == "<name1>"){
    Memo1->SelText =

    This is the point where I am stuck, how do I assign the database to the SelText i.e <Name1> in the MemoBox?

    I would appreciate any help with this
    Thanks
    Clarabell


Comments

  • Registered Users, Registered Users 2 Posts: 2,152 ✭✭✭dazberry


    Originally posted by clarabell
    Hi all,
    I want to link these field names with a database called "Maildata.mdb".
    I have already created the database with the same field headings.
    I want to replace <Name1>, <Name2> etc in the memobox with the data contained in the database.

    File *in;

    in = fopen("MailData.mdb","r");

    if(Form1->Memo1->SelText == "<name1>"){
    Memo1->SelText =


    You appear to be opening the database as a binary file, and from the extension it looks like an access database ??? If you have actually created the database in say Access, you will need to open the database using something like the BDE (shudder) or better layer.

    If you do, it will be available from a TDataSet decendant, so you can use something like
    Memo1->SelText = myDataSet.FieldByName('name1') -> asString.

    However, if you've created the database as a binary file (fixed length records), you'll need to load it into a record (struct in C) and access the specific member. My C is far to rusty to remember how to do that.

    D.


Advertisement