0

I have a program that's throwing the following error:

Format of the initialization string does not conform to specification starting at index 0. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentException: Format of the initialization string does not conform to specification starting at index 0.

Source Error:

Line 203: public static int GetRandomAlbumID() {  
Line 204: using (SqlConnection connection = new  SqlConnection(ConfigurationManager.ConnectionStrings["Personal"].ConnectionString)) {   
Line 205: using (SqlCommand command = new SqlCommand("GetNonEmptyAlbums", connection)) {  
Line 206: command.CommandType = CommandType.StoredProcedure;

Source File: c:\inetpub\vhosts\taniabags.gr\httpdocs\App_Code\PhotoManager.cs Line: 204

what can i do ?Please a little help

Joel Coehoorn
  • 380,066
  • 110
  • 546
  • 781
kostas
  • 1
  • Let's see line 204 of `PhotoManager.cs`. – Mike Strobel Nov 05 '13 at 18:18
  • 1
    @MikeStrobel it's in there... just not obvious. – Joel Coehoorn Nov 05 '13 at 18:19
  • 1
    Your connection string is bad. Fix it. If you post the actual string here, someone might even help you fix it. – Joel Coehoorn Nov 05 '13 at 18:20
  • 1
    I'm guessing it is `ConfigurationManager.ConnectionStrings["Personal"].ConnectionString`, but without knowing what it is, hard to tell how it is formatted badly. – crashmstr Nov 05 '13 at 18:20
  • Take a look at this SO post, for a little on connection strings: http://stackoverflow.com/questions/2828060/c-sharp-configuration-manager-connectionstrings – Doug_Ivison Nov 05 '13 at 18:25
  • It would also help to know if your program is a console app, or a web site... or whatever. Simply searching StackOverflow for the error message `Format of the initialization string does not conform to specification` shows many pages to look at... this being another good one: http://stackoverflow.com/questions/8243008/format-of-the-initialization-string-does-not-conform-to-specification-starting-a – Doug_Ivison Nov 05 '13 at 18:35
  • 1
    FYI: when posting the connectionstring here, remember to XXX'out any passwords and hostnames/IPs ;) – quetzalcoatl Nov 05 '13 at 19:35

0 Answers0