Skip to Content
avatar image
Former Member

How can change database location (.mdb : Access) in C++ (MFC)

Hello;

I'm on Visual studio 2010. My code is in C++ (MFC)

My question is simple:

My ".rpt" file use (point) an Access database located in "c:\.....\user111\myDatabase.mdb"

I need to change "AT RUN-TIME" the le location of my database to "c:\.....\user222\myDatabase.mdb"

I need to do this because "myDatabase.mdb" are storted in LocalAppData, so the path change from a user (user111) to another one (user222).

Remarque : I Can't changes install rules of company.

Best Regards,

Ridha

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • avatar image
    Former Member
    Sep 15, 2017 at 08:03 AM

    Good Morning,

    I use the version 13 of crystal reports on visual studio c++ 2010.

    I foud some topics about this, i must do something like that :

    for(int i = 0 ; i < crReportDocument->Database->Tables->Count ; i++)
    {
    IDatabaseTablePtr theTablePtr = crReportDocument->Database->Tables->Item;

    theTablePtr.setDataSource (...);

    }

    but it not work because datastruct and methodes are not good.

    Best Regards,

    Ridha.

    Add comment
    10|10000 characters needed characters exceeded

  • Sep 14, 2017 at 04:43 PM

    What CR SDK are you using?

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Good Morning,

      I use the version 13 of crystal reports on visual studio c++ 2010.

      Best Regards.

      Ridha

  • Sep 15, 2017 at 05:43 PM
    Add comment
    10|10000 characters needed characters exceeded