473,322 Members | 1,806 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Format of the initialization string does not conform to specification starting at index 0.

Hi all,
with a little help from my friends, I am trying to construct a
connectionstring from a relative path in web.config.
It contains
<add key="conAccess" value="microsoft.jet.oledb.4.0;data
source=data/database.mdb" />

In my webform I constructed a fucntion

Public Function getConnectionString() As String
Dim conString As String =
System.Configuration.ConfigurationSettings.AppSett ings.Item("conAccSucculent
en")
Dim relPathPositie As Integer = conString.IndexOf("data source=") +
12
Dim puntKommaPositie As Integer = conString.IndexOf(";"c,
relPathPositie)
Dim relPath As String
If puntKommaPositie = -1 Then
relPath = conString.Substring(relPathPositie)
Else
relPath = conString.Substring(relPathPositie,
puntKommaPositie - relPathPositie)
End If
Dim absPath As String = Server.MapPath("~\" & relPath)
Return absPath

End Function

This returns the correct absolute path (tested) which I then use in
Dim conAccessSucculenten As New OleDbConnection(getConnectionString())

No way José, whatever I trie I keep on getting

Format of the initialization string does not conform to specification
starting at index 0.

Any Idea where I'm going wrong?

Jan
Nov 18 '05 #1
1 32389
Hi, Jan,

Are you sure there is a semicolon (;) at the end of the string after you
reconstruct it?

What is the connectionstring at the end any way?

Greetings
Martin
"openleren" <op*******@skynet.be> wrote in message
news:41*********************@news.skynet.be...
Hi all,
with a little help from my friends, I am trying to construct a
connectionstring from a relative path in web.config.
It contains
<add key="conAccess" value="microsoft.jet.oledb.4.0;data
source=data/database.mdb" />

In my webform I constructed a fucntion

Public Function getConnectionString() As String
Dim conString As String =
System.Configuration.ConfigurationSettings.AppSett ings.Item("conAccSucculent en")
Dim relPathPositie As Integer = conString.IndexOf("data source=") + 12
Dim puntKommaPositie As Integer = conString.IndexOf(";"c,
relPathPositie)
Dim relPath As String
If puntKommaPositie = -1 Then
relPath = conString.Substring(relPathPositie)
Else
relPath = conString.Substring(relPathPositie,
puntKommaPositie - relPathPositie)
End If
Dim absPath As String = Server.MapPath("~\" & relPath)
Return absPath

End Function

This returns the correct absolute path (tested) which I then use in
Dim conAccessSucculenten As New OleDbConnection(getConnectionString())

No way José, whatever I trie I keep on getting

Format of the initialization string does not conform to specification
starting at index 0.

Any Idea where I'm going wrong?

Jan

Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Uday Deo | last post by:
Hi everyone, I have a .NET app invoking from the ASP page. It has to load bunch of data during first visit. The app works fine on the Staging and Prod server. This is the first time the company...
0
by: Galahad | last post by:
I experience the following error when my web.config file attempts to read an encryped sql connection string: Format of the initialization string does not conform to specification. The hotfix...
0
by: Nick | last post by:
I am getting the following error when connecting to a access database via ODBC if the path contains a ascii character 127. Character 127 is a valid character for a path however access can not...
29
by: zoro | last post by:
Hi, I am new to C#, coming from Delphi. In Delphi, I am using a 3rd party string handling library that includes some very useful string functions, in particular I'm interested in BEFORE (return...
0
by: Gaurav | last post by:
Hi, I have a connection string "Data Source=db1.mynet;DATABASE=test;User ID=testuser;Password=test;" , when i use the connection string to get a dataset of all the tables of a database it...
0
by: andy | last post by:
Hi all, Any help much appreciated - Andy I am trying to connect to a SQL Server DB using c#, ADO.Net mySqlConnection = new...
13
by: Roy | last post by:
Hi all, I'm creating a project that should always use this date format when displays the dates or create dates. The back end database is a SQL Server and I like to know what is the logical way...
79
by: VK | last post by:
I wandering about the common proctice of some UA's producers to spoof the UA string to pretend to be another browser (most often IE). Shouldn't it be considered as a trademark violation of the...
6
by: Patient Guy | last post by:
The question in the subject seems plain to me. I wonder if EMCAscript/Javascript developers should even bother adding IE7 even to the clients in which to test script/code. The same goes for any...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.