Wednesday, March 7, 2012

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

can't figure out this error. i think i'm writing something wrong in the connnection string. i'm using SQL Server Express, if that helps.

in my config file:

<connectionStrings>
<add name="OfficialScribblerConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\OfficialScribbler.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient"/>
</connectionStrings>

in my aspx file:

Dim DBConnection = New OleDbConnection("OfficialScribblerConnectionString")

DBConnection.Open()

Dim SQLString As String = "SELECT PostedDate From Entries_tbl ORDER BY PostedDate"

Try this way

Dim DBConnection = New OleDbConnection(ConfigurationManager.ConnectionStrings("OfficialScribblerConnectionString").ConnectionString)

Hope this will help you

|||thanks for the tip. i will try later on and let you know how it goes.|||

i tried that and now the error says this:

An OLE DB Provider was not specified in the ConnectionString. An example would be, 'Provider=SQLOLEDB;'.

|||

Change the connection string as

<

addname="OfficialScribblerConnectionString"connectionString="Provider=SQLOLEDB;Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\OfficialScribbler.mdf;Integrated Security=True;User Instance=True"providerName="System.Data.SqlClient"/>Change the code to

Dim

DBConnectionAsNew OleDbConnection(ConfigurationManager.ConnectionStrings("OfficialScribblerConnectionString").ConnectionString)

DBConnection.Open()

Hope this will help you.

Let me know if you need any further help

No comments:

Post a Comment