Link to home
Start Free TrialLog in
Avatar of Buck Beasom
Buck BeasomFlag for United States of America

asked on

Access 2007 Connection

I have a VB2010 application that is connecting to a Microsoft Jet SQL back end that is installed on PCs with Access 2003 loaded. Presumably the installation of Access 2003 also registers the machine with Microsoft.Jet.OLEDB.4.0.

We are starting to transition users over to Office 2007 (even though virtually none of them actually use Access.) But apparently this transition has messed up the ability to access the old Access MDB, because when the first user tried to log into my app, they got a message:

The Microsoft.Jet.OLEDB.4.0 provider is not registered on the local machine.

Do I have to create a new application for the 2007 machines with a new connection string? Or is there something else that will allow machines with EITHER Access 2003 or Access 2007 to access the mdb on the server?

Thanks.
Avatar of Nico Bontenbal
Nico Bontenbal
Flag of Netherlands image

Hi,
there is no need to create different application,
just add connection string as following:

Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\myFolder\myAccess2007file.accdb;Persist Security Info=

notice that there is change in provider
thanks
Avatar of Buck Beasom

ASKER

OK. But if I do that, and redeploy the application, will those folks who still only have Access 2003 on their computers also be able to access the data?

Thanks.
for such case you can use app.config to store connection string and just add related settings in app.config for 2003 and 2007 so your code will not need to be changed what you have to do is just change in config
OK, but I need some help here. I find the app.config file in my application development environment and the code is attached. But when I went to one of the machines where the application is installed, I can't find an app.config file on that computer.

I'm pretty sure there is a way to get the application to look at some locally stored config file to get stuff like the connection string. (I did that in VB way back in the late 90s.) Then, as you indicate, I can have a customized config file for each user depending on which connection string they should use. But it does not appear that the app.config file is deploying with the application itself, and it is being constructed by VB 2010, not by me. So I really need to know 2 things:

1) What do I have to do inside the application to get it to look in a config file OUTSIDE the application for the Connection String data and

2) Where do I put that file (be it app.config, config.db or whatever) on the client so that the application will find it when it launches?

Thanks.

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <configSections>
        <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
            <section name="TBOPacing.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
        </sectionGroup>
    </configSections>
    <system.diagnostics>
        <sources>
            <!-- This section defines the logging configuration for My.Application.Log -->
            <source name="DefaultSource" switchName="DefaultSwitch">
                <listeners>
                    <add name="FileLog"/>
                    <!-- Uncomment the below section to write to the Application Event Log -->
                    <!--<add name="EventLog"/>-->
                </listeners>
            </source>
        </sources>
        <switches>
            <add name="DefaultSwitch" value="Information" />
        </switches>
        <sharedListeners>
            <add name="FileLog"
                 type="Microsoft.VisualBasic.Logging.FileLogTraceListener, Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"
                 initializeData="FileLogWriter"/>
            <!-- Uncomment the below section and replace APPLICATION_NAME with the name of your application to write to the Application Event Log -->
            <!--<add name="EventLog" type="System.Diagnostics.EventLogTraceListener" initializeData="APPLICATION_NAME"/> -->
        </sharedListeners>
    </system.diagnostics>
    <applicationSettings>
        <TBOPacing.Settings>
            <setting name="Provider" serializeAs="String">
                <value>Microsoft.Jet.OLEDB.4.0</value>
            </setting>
            <setting name="DataSource" serializeAs="String">
                <value>\\tbo-prod\Exchange\Pacing_Management\VB_PacingData.mdb</value>
            </setting>
            <setting name="InitialCatalog" serializeAs="String">
                <value>Nothing</value>
            </setting>
            <setting name="UserID" serializeAs="String">
                <value>Nothing</value>
            </setting>
            <setting name="Password" serializeAs="String">
                <value>Nothing</value>
            </setting>
        </TBOPacing.Settings>
    </applicationSettings>
</configuration>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Imran Javed Zia
Imran Javed Zia
Flag of Pakistan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I'm still missing some core concepts here.

My settings are attached. If I understand you correctly, I need to add a setting to tell the application that there is a config file where it can get values. But because I am relatively new at this, I have been relying on the deployment tools to do most of the heavy lifting. The other strange thing is that I can't even find a .exe file on the client machine that matches my application name. So when I launch the "Setup.exe" that is provided by the deployment tool, I know it is going out and getting the app, but I don't know where it is putting it.

Sorry to be so dense about this.

Thanks.
ApplicationSettings.bmp