Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Path Specification In Connection String (VB.NET)

Posted on 2010-11-15
3
Medium Priority
?
371 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 248 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 252 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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

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)…
In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
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…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

730 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