3 Replies - 1320 Views - Last Post: 03 March 2009 - 01:01 AM Rate Topic: -----

#1 Damage  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 27
  • View blog
  • Posts: 1,077
  • Joined: 05-June 08

Connection error when using project settings

Posted 25 February 2009 - 01:54 AM

Hi,

i get this error
Format of the initialization string does not conform to specification starting at index 34.



when i take my connection string and store it in the project settings. I know that this works

Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & Application.StartupPath & "\Employees.accdb



because if i use it like this

Dim conn As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & Application.StartupPath & "\Employees.accdb")
 conn.Open()


the connection succeeds but if i try this
Dim conn As New OleDbConnection(My.Settings.Default.employeeConnection)
conn.Open()


i get that error.

What am i doing wrong?

sorry i forgot to mention the settings

name:employeeConnection
type:string
scope:application
value:Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & Application.StartupPath & "\Employees.accdb

Is This A Good Question/Topic? 0
  • +

Replies To: Connection error when using project settings

#2 Damage  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 27
  • View blog
  • Posts: 1,077
  • Joined: 05-June 08

Re: Connection error when using project settings

Posted 27 February 2009 - 06:45 PM

would it work if i added it directly to the .config file? Which i have tried but can't figure out the exact syntax i need to use? or is there a simple "oh you need to put a ' instead of a " "type answer?
Was This Post Helpful? 0
  • +
  • -

#3 AdamSpeight2008  Icon User is offline

  • MrCupOfT
  • member icon


Reputation: 1948
  • View blog
  • Posts: 8,664
  • Joined: 29-May 08

Re: Connection error when using project settings

Posted 27 February 2009 - 06:53 PM

Are you define resource settings for example.

In the project's resources add couple of new settings
ConStr_Part1
ConStr_Part2

Set ConStr_Part1 to Microsoft.ACE.OLEDB.12.0;Data Source=
Set ConStr_Part2 to \Employees.accdb

the in your code do
Dim conn As New OleDbConnection(My.Settings.ConStr_Part1 & Application.StartupPath & ConStr_Part2)
conn.Open()



Was This Post Helpful? 0
  • +
  • -

#4 Damage  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 27
  • View blog
  • Posts: 1,077
  • Joined: 05-June 08

Re: Connection error when using project settings

Posted 03 March 2009 - 01:01 AM

nope still getting the same error
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1