Solved

Path Specification In Connection String (VB.NET)

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

747 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

9 Experts available now in Live!

Get 1:1 Help Now