473,769 Members | 2,088 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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
connectionstrin g from a relative path in web.config.
It contains
<add key="conAccess" value="microsof t.jet.oledb.4.0 ;data
source=data/database.mdb" />

In my webform I constructed a fucntion

Public Function getConnectionSt ring() As String
Dim conString As String =
System.Configur ation.Configura tionSettings.Ap pSettings.Item( "conAccSucculen t
en")
Dim relPathPositie As Integer = conString.Index Of("data source=") +
12
Dim puntKommaPositi e As Integer = conString.Index Of(";"c,
relPathPositie)
Dim relPath As String
If puntKommaPositi e = -1 Then
relPath = conString.Subst ring(relPathPos itie)
Else
relPath = conString.Subst ring(relPathPos itie,
puntKommaPositi e - 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 conAccessSuccul enten As New OleDbConnection (getConnectionS tring())

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 32449
Hi, Jan,

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

What is the connectionstrin g at the end any way?

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

In my webform I constructed a fucntion

Public Function getConnectionSt ring() As String
Dim conString As String =
System.Configur ation.Configura tionSettings.Ap pSettings.Item( "conAccSucculen t en")
Dim relPathPositie As Integer = conString.Index Of("data source=") + 12
Dim puntKommaPositi e As Integer = conString.Index Of(";"c,
relPathPositie)
Dim relPath As String
If puntKommaPositi e = -1 Then
relPath = conString.Subst ring(relPathPos itie)
Else
relPath = conString.Subst ring(relPathPos itie,
puntKommaPositi e - 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 conAccessSuccul enten As New OleDbConnection (getConnectionS tring())

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
1765
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 got the separate machine as a Development server. I have installed .NET Visual studio and framework on the machine. I copied all the files and necessary information from staging to the development box. I am getting the following error while...
0
1207
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 for this issue is installed on my machine and the ASPNET SVC account has read access to the string value in the registry. Any advice on this issue is extremely appreciated. No other developers have this error so I assume that is machine related.
0
2277
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 handle this character. Here is the path I am sending on the connecetion string. Long File Name 001 - +] {#@rȠք....㩵}u ѣ 68 BG3 H ▧YЙ..!Iҵi@ǧH1+͕UYtOQ'g8..= As you can see from...
29
4324
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 substring before a pattern), AFTER (return substring after a pattern), and BETWEEN (return substring between 2 patterns). My questions are: 1. Can any tell me how I can implement such functionality in C#? 2. Is it possible to add/include function...
0
5032
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 works without any problem, but when i try and call a stored procedure i get an exception trace like :
0
1544
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 SqlConnection(@"user=ddd;password=jfn;server=srv5;Trusted_Connection=no;database=dan"); as you can see there are "special" ASCII chars in the user and password
13
3302
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 to configure server, sql server or program so it always deals with date as mm/dd/yyyy format. Thanks in advance. Roy
79
3794
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 relevant name owner? If I make a whisky and call it "Jack Daniels", I most probably will have some serious legal problems. "Mozilla" partially appeared because NCSA stopped them from using "Mosaic" in the UA string. Is it some different...
6
1227
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 web document, interactive/dynamic or otherwise, developer: does IE7 finally get CSS right, and to what level?
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10216
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10049
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9997
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9865
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5310
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3565
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.