Solved

Connecting to a databse

Posted on 2008-10-12
3
326 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

776 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