StrataFrame Forum

Access database

http://forum.strataframe.net/Topic23249.aspx

By Ian Hammond - 5/27/2009

Hi,

I am trying to write an application that allows me to transfer the data from an 'old style' access database to a 'new style' SQL database. I have restructured the target database and I have an app that allows me to interact with the SQLdatabase via BO's that I have written based on the table structure.

I want a BO for the Access database so in the VS iDE I have set a connection to the table and have attempted to create a BO. When I try to configure the BO (Business Object Properties) by selecting OLEDB and the 'Select Source' button I get the following response:

An error occurred while attempting to open the data source with connection string:

[Provider= Microsoft.JET.OLEDB.4.0;DataSource= "MyDataSource";]

Exception: Not a Valid password.

When I click OK it just returns to the "Select OLE DB Table" and I have to Cancel.

How do I get the password into the connection string at this juncture?

By Trent L. Taylor - 5/28/2009

I am assuming that your MDB requires a password. This is a standard connection string element that you may need to supply. For example:



Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\mydatabase.mdb;Jet OLEDBBigGrinatabase Password=MyDbPassword;




There a ton of samples out on the internet if you do a Google. Here is the top 1 when I searched just now:



http://www.connectionstrings.com/access
By Ian Hammond - 5/28/2009

Hi,

Thanks for your reply.

Yes, I understand how to set a connection progammatically, but, I was trying to create a BO using the BOM. In the IDE I added a new connection:

Set the Data Source to Microsoft Access Database

Browsed to the database on which to base the BO.

I logged into the database by supplying User Name Admin and the password. 

When I closed the dialog, the structure of the database is displayed under the Server Explorere tree structure.

I then open the BOM to configure the BO and when I try to select the source I get the Not a valid password message.

This is where I found myself stuck.

I put a connection string explicity into the Connection String override box by adding the connection string from the Connection String dialog and appending the user id and password:

Provider=Microsoft.Jet.OLEDB.4.0;Data Source="E:\HLS Pro.Net Development\HLS Pro Databases\Config.mdb"; User Id = "Admin"; Password= "myPW"

When I Select again, I have Enumerating Tables displayed and the exception:

Cannot start you appliaction. The workgroup information file is missing or opened exclusively by another user.

Why do I need to supply a password again if I have a valid connection

Can these responses by the BOM be explained?

Many thanks.

By Trent L. Taylor - 6/1/2009

The connection string details I gave you, Ian, were for the BO Mapper. You still must have a valid connection in order to produce a schema. So whether you are connecting to the MDB via the BO Mapper or in your run-time application, you must supply a valid connection.



Next, I see that you have this supplied in the BO mapper, and that when you get the schema information on the BO you are getting the exception. The very same connection is used. I have tried this on the most recent build on my side and it is working. So possibly I am not using the same version of an MDB or security settings. If you can supply a simple Access database with a password setup like your environment, I would be more than happy to try it out here so that I can see what you are experiencing. Thanks.
By Ian Hammond - 6/7/2009

Thanks for the offer, I'll get something sorted.