C++ using MS Access as Database

Dear all,
i want to do a simple program in c++ & it use MS Access as database.
If have idea plz send the codings.
Thanks,
Edwin
«1

Comments

  • : Dear all,
    : i want to do a simple program in c++ & it use MS Access as database.
    : If have idea plz send the codings.
    : Thanks,
    : Edwin
    :


    Depending on what compiler you are using, there are easy ways to do it.
    Might be smart to post that, since MS Access isn't part of the C++ standard...
  • : : Dear all,
    : : i want to do a simple program in c++ & it use MS Access as database.
    : : If have idea plz send the codings.
    : : Thanks,
    : : Edwin
    : :
    :
    :
    : Depending on what compiler you are using, there are easy ways to do it.
    : Might be smart to post that, since MS Access isn't part of the C++ standard...
    :
    Dear,
    I am using Turboc3 compiler in windows xp
    Thanxs, edwin
  • : : : Dear all,
    : : : i want to do a simple program in c++ & it use MS Access as database.
    : : : If have idea plz send the codings.
    : : : Thanks,
    : : : Edwin
    : : :
    : :
    : :
    : : Depending on what compiler you are using, there are easy ways to do it.
    : : Might be smart to post that, since MS Access isn't part of the C++ standard...
    : :
    : Dear,
    : I am using Turboc3 compiler in windows xp
    : Thanxs, edwin
    :


    Ouch. There is no easy way then. The only way for you would be to read the Access db as a binary and parse through it... but only a masochist would do that. Get yourself a Windows compiler already.
  • : : : : Dear all,
    : : : : i want to do a simple program in c++ & it use MS Access as database.
    : : : : If have idea plz send the codings.
    : : : : Thanks,
    : : : : Edwin
    : : : :
    : : :
    : : :
    : : : Depending on what compiler you are using, there are easy ways to do it.
    : : : Might be smart to post that, since MS Access isn't part of the C++ standard...
    : : :
    : : Dear,
    : : I am using Turboc3 compiler in windows xp
    : : Thanxs, edwin
    : :
    :
    :
    : Ouch. There is no easy way then. The only way for you would be to read the Access db as a binary and parse through it... but only a masochist would do that. Get yourself a Windows compiler already.
    :
    Dear,
    anyway help me or give suggessions..
  • [b][red]This message was edited by stober at 2007-1-16 5:8:49[/red][/b][hr]
    [b][red]This message was edited by stober at 2007-1-16 5:6:23[/red][/b][hr]
    : anyway help me or give suggessions..
    :

    As Lundin said, you can not access MSAccess database with your compiler -- its just too freaken old. Get yourself a newer modern, free compiler, such as Dev-C++ at www.bloodshed.net or MS VC++ 2005 Express.

    You can also get the latest version of Turbo C++ which I think will let you connect to MS Access database.
    http://www.turboexplorer.com/cpp




  • : [b][red]This message was edited by stober at 2007-1-16 5:8:49[/red][/b][hr]
    : [b][red]This message was edited by stober at 2007-1-16 5:6:23[/red][/b][hr]
    : : anyway help me or give suggessions..
    : :
    :
    : As Lundin said, you can not access MSAccess database with your compiler -- its just too freaken old. Get yourself a newer modern, free compiler, such as Dev-C++ at www.bloodshed.net or MS VC++ 2005 Express.
    :
    : You can also get the latest version of Turbo C++ which I think will let you connect to MS Access database.
    : http://www.turboexplorer.com/cpp
    :
    : Ok., Then shall i use MS Sql ser?
    :
    :
    :

  • : :
    : : Ok., Then shall i use MS Sql ser?
    : :

    Not with old version of Turbo C. That compiler can not access any modern database that runs on MS-Windows operating system. If you do not want to upgrade your compiler then you will probably want to write your own database.
  • : : :
    : : : Ok., Then shall i use MS Sql ser?
    : : :
    :
    : Not with old version of Turbo C. That compiler can not access any modern database that runs on MS-Windows operating system. If you do not want to upgrade your compiler then you will probably want to write your own database.
    :


    Yep. I don't know about you people, but rather write my own SQL DB managment system than upgrading from TC. :-)
  • :
    : Yep. I don't know about you people, but rather write my own SQL DB managment system than upgrading from TC. :-)
    :

    I didn't suggest writing an SQL DB, but just design a file system that would support what he wants, doesn't have to be complicated.
  • : :
    : : Yep. I don't know about you people, but rather write my own SQL DB managment system than upgrading from TC. :-)
    : :
    :
    : I didn't suggest writing an SQL DB, but just design a file system that would support what he wants, doesn't have to be complicated.
    :
    Fine. I am ready to upgrade from TC then guide me how to upgrade it? &
    further steps to connect MS Access.
    -edwin
  • : : :
    : : : Yep. I don't know about you people, but rather write my own SQL DB managment system than upgrading from TC. :-)
    : : :
    : :
    : : I didn't suggest writing an SQL DB, but just design a file system that would support what he wants, doesn't have to be complicated.
    : :
    : Fine. I am ready to upgrade from TC then guide me how to upgrade it? &
    : further steps to connect MS Access.
    : -edwin
    :


    Start by reading stober's post:

    http://www.programmersheaven.com/c/MsgBoard/read.asp?Board=3&MsgID=352328&;

    Then download a compiler of your choise. Turbo Builder is likely much more user-friendly when it comes to database access, but it is a 500MB download.
  • : : Dear all,
    : : i want to do a simple program in c++ & it use MS Access as database.
    : : If have idea plz send the codings.
    : : Thanks,
    : : Edwin
    : :
    :
    :
    : Depending on what compiler you are using, there are easy ways to do it.
    : Might be smart to post that, since MS Access isn't part of the C++ standard...
    :


    Hi

    i hereby send some part of code

    ODBC CONNECTIVITY:

    #include

    #include

    #include

    int main(void)

    {

    HENV hEnv = NULL;
    // Env Handle from SQLAllocEnv()

    HDBC hDBC = NULL;
    // Connection handle

    HSTMT hStmt = NULL;
    // Statement handle

    UCHAR szDSN[SQL_MAX_DSN_LENGTH] = "mpj8";
    // Data Source Name buffer

    UCHAR* szUID = NULL;
    // User ID buffer

    UCHAR* szPasswd = NULL;
    // Password buffer

    UCHAR szModel[128];

    // Model buffer

    SDWORD cbModel;

    // Model buffer bytes recieved

    UCHAR szSqlStr[250]= "Select * From bank";


    // SQL string

    RETCODE retcode;

    // Return code

    // Allocate memory for ODBC Environment handle

    SQLAllocEnv (&hEnv);



    // Allocate memory for the connection handle

    SQLAllocConnect (hEnv, &hDBC);



    // Connect to the data source "db97" using userid and password.

    retcode = SQLConnect (hDBC, szDSN, SQL_NTS, szUID, SQL_NTS, szPasswd, SQL_NTS);


    if (retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO)

    {

    // Allocate memory for the statement handle

    retcode = SQLAllocStmt (hDBC, &hStmt);



    // Prepare the SQL statement by assigning it to the statement handle

    retcode = SQLPrepare (hStmt, szSqlStr, sizeof (szSqlStr));



    // Execute the SQL statement handle

    retcode = SQLExecute (hStmt);



    // Project only column 1 which is the models

    SQLBindCol (hStmt, 1, SQL_C_CHAR, szModel, sizeof(szModel), &cbModel);

    // Get row of data from the result set defined above in the statement
    retcode = SQLFetch (hStmt);

    while (retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO)

    {

    printf( %s
    ,szModel);

    // Print row (model)

    retcode = SQLFetch (hStmt);
    // Fetch next row from result set

    }



    // Free the allocated statement handle

    SQLFreeStmt (hStmt, SQL_DROP);



    // Disconnect from datasource

    SQLDisconnect (hDBC);

    }



    // Free the allocated connection handle

    SQLFreeConnect (hDBC);



    // Free the allocated ODBC environment handle

    SQLFreeEnv (hEnv);
    return 0;

    }



    G.Jayakanthan
  • : : : Dear all,
    : : : i want to do a simple program in c++ & it use MS Access as database.
    : : : If have idea plz send the codings.
    : : : Thanks,
    : : : Edwin
    : : :
    : :
    : :
    : : Depending on what compiler you are using, there are easy ways to do it.
    : : Might be smart to post that, since MS Access isn't part of the C++ standard...
    : :
    :
    :
    : Hi
    :
    : i hereby send some part of code
    :
    : ODBC CONNECTIVITY:
    :
    : #include
    :
    : #include
    :
    : #include
    :
    : int main(void)
    :
    : {
    :
    : HENV hEnv = NULL;
    : // Env Handle from SQLAllocEnv()
    :
    : HDBC hDBC = NULL;
    : // Connection handle
    :
    : HSTMT hStmt = NULL;
    : // Statement handle
    :
    : UCHAR szDSN[SQL_MAX_DSN_LENGTH] = "mpj8";
    : // Data Source Name buffer
    :
    : UCHAR* szUID = NULL;
    : // User ID buffer
    :
    : UCHAR* szPasswd = NULL;
    : // Password buffer
    :
    : UCHAR szModel[128];
    :
    : // Model buffer
    :
    : SDWORD cbModel;
    :
    : // Model buffer bytes recieved
    :
    : UCHAR szSqlStr[250]= "Select * From bank";
    :
    :
    : // SQL string
    :
    : RETCODE retcode;
    :
    : // Return code
    :
    : // Allocate memory for ODBC Environment handle
    :
    : SQLAllocEnv (&hEnv);
    :
    :
    :
    : // Allocate memory for the connection handle
    :
    : SQLAllocConnect (hEnv, &hDBC);
    :
    :
    :
    : // Connect to the data source "db97" using userid and password.
    :
    : retcode = SQLConnect (hDBC, szDSN, SQL_NTS, szUID, SQL_NTS, szPasswd, SQL_NTS);
    :
    :
    : if (retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO)
    :
    : {
    :
    : // Allocate memory for the statement handle
    :
    : retcode = SQLAllocStmt (hDBC, &hStmt);
    :
    :
    :
    : // Prepare the SQL statement by assigning it to the statement handle
    :
    : retcode = SQLPrepare (hStmt, szSqlStr, sizeof (szSqlStr));
    :
    :
    :
    : // Execute the SQL statement handle
    :
    : retcode = SQLExecute (hStmt);
    :
    :
    :
    : // Project only column 1 which is the models
    :
    : SQLBindCol (hStmt, 1, SQL_C_CHAR, szModel, sizeof(szModel), &cbModel);
    :
    : // Get row of data from the result set defined above in the statement
    : retcode = SQLFetch (hStmt);
    :
    : while (retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO)
    :
    : {
    :
    : printf( %s
    ,szModel);
    :
    : // Print row (model)
    :
    : retcode = SQLFetch (hStmt);
    : // Fetch next row from result set
    :
    : }
    :
    :
    :
    : // Free the allocated statement handle
    :
    : SQLFreeStmt (hStmt, SQL_DROP);
    :
    :
    :
    : // Disconnect from datasource
    :
    : SQLDisconnect (hDBC);
    :
    : }
    :
    :
    :
    : // Free the allocated connection handle
    :
    : SQLFreeConnect (hDBC);
    :
    :
    :
    : // Free the allocated ODBC environment handle
    :
    : SQLFreeEnv (hEnv);
    : return 0;
    :
    : }
    :
    :
    :
    : G.Jayakanthan
    :
    ok. jayakanthan.
    what is the c compiler ur using?
    because in my compiler windows.h is not there.
    - edwin

  • : : : :
    : : : : Yep. I don't know about you people, but rather write my own SQL DB managment system than upgrading from TC. :-)
    : : : :
    : : :
    : : : I didn't suggest writing an SQL DB, but just design a file system that would support what he wants, doesn't have to be complicated.
    : : :
    : : Fine. I am ready to upgrade from TC then guide me how to upgrade it? &
    : : further steps to connect MS Access.
    : : -edwin
    : :
    :
    :
    : Start by reading stober's post:
    :
    : http://www.programmersheaven.com/c/MsgBoard/read.asp?Board=3&MsgID=352328&;
    :
    : Then download a compiler of your choise. Turbo Builder is likely much more user-friendly when it comes to database access, but it is a 500MB download.
    :
    Ok, i have downloaded the Borland Turbo C++ compiler.
    then can u help me to write a simple c++ programe that using ms access database
    (ie) i wants to add, update, select a neme & telno using a table.
    regards,
    edwin

  • Sir,
    I dont know how to connect ms access with Borland C++5.0.I have borland C++ 5.0.I need to perform simple add,delete,search,select,update opeartions with access database.can u help me Sir?.
    thanking u

    regards
    vjs riya
This discussion has been closed.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories