Connect  Visual C++ 2005 to MS-Access

Posted on 2007-07-26
Last Modified: 2008-02-01
Iam using Visual C++ 2005 and I have successfully connected  my MS-Access Database with my application from "Connect to Database" in the "TOOLS" menu.Because I am  a newbee in programming I would like to know the procedure for writing an sql query to access and modify my data in any way I want.My common sense tells me that I need a connection variable that will be equal to  the value of the sql query I want to write.Please en light me  here.If you also know the procedure for SQL Server please let me know.
Question by:Spyros_Savvides
    1 Comment
    LVL 1

    Accepted Solution

    From SQL Server 2005, you will need to add a linked server to your Access DB


    EXEC sp_addlinkedserver       @server='whateveryouwanttocallthelink',
                            @provider='SQLNCLI', //*this is just an example, you'll have to find out what provider Access uses*\\
                            @provstr='DRIVER={SQL SERVER}; //*this is just an example, you'll have to find out what driver it uses, possible ODBC?*\\

    You may need to add a login for this as well, I know you do with linking SQL servers, but never linked Access DB's. - Look for Exec sp_addlinkedsrvlogin

    When you want to query your new linked server, you'll have to fully qualify it in the where statement, so if you called it Access, it would be something like - access.database.table

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
    A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
    In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
    In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now