Solved

Path Specification In Connection String (VB.NET)

Posted on 2010-11-15
3
362 Views
Last Modified: 2012-08-14

Hi

At thhe start of my Application's Module I have the following code:

Public sPath As String

When my application starts, I have the following code:

sPath = Application.StartUpPath
 
My Connection String looks like this:
         QtCon.ConnectionString = "Provider=Microsoft.Ace.OLEDB.12.0;Data Source=C:\Mayibuye\Quotations.accdb"

Now for obvious reasons, when I deploy the Application, I need to include the definition of Path into this connection. When I use sPath immediately after DataSource=, then I get an error with the following description:

"Format Of The Initialisation String Does Not Conform To Specification."

I am sure there must be a good (or better) way of doing this. Can somebody help me please.

I am Using VB.NET (Visual Studio 2008) under Windows XP Pro.

Thanks


0
Comment
Question by:Nolanc
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 52

Assisted Solution

by:Carl Tawn
Carl Tawn earned 62 total points
ID: 34134985
How are you using sPath in the string? Are you literally adding it into the string, or are you doing something like:

QtCon.ConnectionString = "Provider=Microsoft.Ace.OLEDB.12.0;Data Source=" & sPath & "\Quotations.accdb"

Open in new window

0
 
LVL 18

Accepted Solution

by:
Dennis Aries earned 63 total points
ID: 34135003

What line did you try exactly?

QtCon.ConnectionString = String.Format("Provider=Microsoft.Ace.OLEDB.12.0;Data Source={0}\Quotations.accdb", sPath)

usually works.
0
 

Author Closing Comment

by:Nolanc
ID: 34135345
Hi carl tawn and dijaries

Thanks for your prompt responses. The fact of the matter is, I messed up the syntax. Either of the syntaxt suggested by you works perfectly.

Many thanks.
0

Featured Post

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

635 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