Solved

Path Specification In Connection String (VB.NET)

Posted on 2010-11-15
3
350 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

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

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:…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

751 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