Solved

Connecting to a databse

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…
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…

911 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

Need Help in Real-Time?

Connect with top rated Experts

27 Experts available now in Live!

Get 1:1 Help Now