Click here to Skip to main content
15,886,036 members
Articles / Programming Languages / Visual Basic

Simulating Stored Procedures in Microsoft Access using Enterprise Library Application Blocks

Rate me:
Please Sign up or sign in to vote.
3.46/5 (12 votes)
25 Jul 2005MIT6 min read 98.3K   1.1K   37  
Simulating stored procedures in Microsoft Access using Enterprise Library Application Blocks.
To Convert to SQL:

1. Create a Database called: EDAB_Example

2. Create a user in the database called: "EDAB_User" with the password: "password12"

3. Locate the "EDAB_Example.sql" file in the "SQL_Scripts" directory and runn the script to create the Addresses table and the stored procedures.

4. In the "dataConfiguration.config" file (in the main directory) find the following lines and update them if you need to:

        <connectionString name="Sql Connection String">
          <parameters>
            <parameter name="database" value="EDAB_Example" isSensitive="false" />
            <parameter name="Integrated Security" value="False" isSensitive="false" />
            <parameter name="pwd" value="password12" isSensitive="false" />
            <parameter name="server" value="(local)" isSensitive="false" />
            <parameter name="uid" value="EDAB_User" isSensitive="false" />
          </parameters>
        </connectionString>

5. Find the following lines in the "dataConfiguration.config" file (in the main directory):

      <instances>
        <instance name="SQL_CurrentInstance" type="Sql Server" connectionString="Sql Connection String" />
        <instance name="CurrentInstance" type="OleDB" connectionString="OleDB Connection String" />
        <instance name="OleDBInstance" type="OleDB" connectionString="OleDB Connection String" />
        <instance name="SQLInstance" type="Sql Server" connectionString="Sql Connection String" />
      </instances>

6. Change:

	<instance name="CurrentInstance" type="OleDB" connectionString="OleDB Connection String" />

	to

	<instance name="Old_CurrentInstance" type="OleDB" connectionString="OleDB Connection String" />

7. Change:

	<instance name="SQL_CurrentInstance" type="Sql Server" connectionString="Sql Connection String" />

	to

	<instance name="CurrentInstance" type="Sql Server" connectionString="Sql Connection String" />

8. Rebuild the application and you're done!

Notes:
* The EDAB componants cache the settings so you may have to close down Visual Studio and re-open it to get the settings to change.

* The "EDAB_OleDB_StoredProcedures.exe.config" must be in the "/bin" directory for the application to work. It is put there by the "PostBuildEvents.vbproj" project. However, this project will be corrupted if you change it in Visual Studio. if that happens re-copy it from the source. The line:

                PostBuildEvent = 'xcopy /C /I /R /Y  "$(ProjectDir)dataConfiguration.config" "$(ProjectDir)$(OutDir)."&#xd;&#xa;copy  "$(ProjectDir)EDAB_OleDB_StoredProcedures.exe.config" "$(ProjectDir)$(OutDir)."&#xd;&#xa;'

Must be in "PostBuildEvents.vbproj" to work. See "PostBuildActions-Readme.txt" for more information.

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The MIT License


Written By
Software Developer (Senior) http://ADefWebserver.com
United States United States
Michael Washington is a Microsoft MVP. He is a ASP.NET and
C# programmer.
He is the founder of
AiHelpWebsite.com,
LightSwitchHelpWebsite.com, and
HoloLensHelpWebsite.com.

He has a son, Zachary and resides in Los Angeles with his wife Valerie.

He is the Author of:

Comments and Discussions