Solved

Connecting to a databse

Posted on 2008-10-12
3
328 Views
Last Modified: 2012-05-05
Hi, i,m trying to connect to a database in a server. i can connect using local host but when i try to connect it to the database in the server it gie an error

this is the code that i,m using to tel that the database is in the server

Dim dataPath As String = Server.MapPath("dato.mdb")
        Me.AccessDataSource1.ConnectionString = Me.AccessDataSource1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = " & dataPath

but it tel me that the conectionstring can,t be change manualy
i,m using visual web developmet 2005 with visual basic language
0
Comment
Question by:cano63
  • 2
3 Comments
 
LVL 7

Expert Comment

by:ajolly
ID: 22699943
what is the error message ?
0
 
LVL 1

Author Comment

by:cano63
ID: 22706349
System.InvalidOperationException was unhandled by user code
  Message="The AccessDataSource ConnectionString property cannot be set, it is automatically generated."

that's the error
 
0
 
LVL 7

Accepted Solution

by:
ajolly earned 125 total points
ID: 22708334
yes, connection string for AccessDataSource is a read only property.
You need to specify in design time.

You can set DataFile property and it will generate the connection string which you can only read.

Setting only the DataFile will work for you.
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

830 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