Format of the initialization string does not conform to specification starting at index 0.
Wednesday, December 26, 2007 12:35:00 PM
I have saved the database connection string to a key named 'ConnectionString' allowing to access it by calling 'configurationSettings.AppSettings("ConnectionString")
But a red line comes under the configuration in the part of the : 'configurationSettings.AppSettings("ConnectionString")'. When i run it this error appears: Format of the initialization string does not conform to specification starting at index 0.
and says:
Line 4: Public Shared Function GetCategory() As SqlDataReader
Line 5: Dim connection As New SqlConnection(connectionString)
Line 6: Dim command As New SqlCommand("GetCategory", connection)
Line 7: command.CommandType = CommandType.StoredProcedure
Line 8: connection.Open()
What have i done wrong, can anyone please help me...
Take a look at the code i have done:
I have put this in my web.config:
<configuration>
<appSettings>
<add key="connectionString" value="Server=PETE\NetSDK;Integrated Security=True;Initial Catalog=JokePoint" />
</appSettings>
and I have put this in my .vb file:
Public Class Catalog
Public Shared Function GetCategory() As SqlDataReader
Dim Connection As New SqlConnection(connectionString)
Dim Command As New SqlCommand("GetCategory", Connection)
Command.CommandType = CommandType.StoredProcedure
Connection.Open()
Return Command.ExecuteReader(CommandBehavior.CloseConnection)
End Function
Private Shared ReadOnly Property connectionString() As String
Get
Return ConfigurationSettings.AppSettings("connectionString")
End Get
End Property
End Class
Dim command As New SqlCommand("GetCategory", connection)
But a red line comes under the configuration in the part of the : 'configurationSettings.AppSettings("ConnectionString")'. When i run it this error appears: Format of the initialization string does not conform to specification starting at index 0.
and says:
Line 4: Public Shared Function GetCategory() As SqlDataReader
Line 5: Dim connection As New SqlConnection(connectionString)
Line 6: Dim command As New SqlCommand("GetCategory", connection)
Line 7: command.CommandType = CommandType.StoredProcedure
Line 8: connection.Open()
What have i done wrong, can anyone please help me...
Take a look at the code i have done:
I have put this in my web.config:
<configuration>
<appSettings>
<add key="connectionString" value="Server=PETE\NetSDK;Integrated Security=True;Initial Catalog=JokePoint" />
</appSettings>
and I have put this in my .vb file:
Public Class Catalog
Public Shared Function GetCategory() As SqlDataReader
Dim Connection As New SqlConnection(connectionString)
Dim Command As New SqlCommand("GetCategory", Connection)
Command.CommandType = CommandType.StoredProcedure
Connection.Open()
Return Command.ExecuteReader(CommandBehavior.CloseConnection)
End Function
Private Shared ReadOnly Property connectionString() As String
Get
Return ConfigurationSettings.AppSettings("connectionString")
End Get
End Property
End Class
Dim command As New SqlCommand("GetCategory", connection)






