How to fix error ::Format of the initialization string does not conform to specification starting at index 0::

后端 未结 18 1951
一向
一向 2020-11-30 11:04

I uploaded my site on godaddy shared host. I can access this database from my management studio. I can\'t access this database from my site

18条回答
  •  自闭症患者
    2020-11-30 12:04

    I originally was calling the connection string value as shown below (VB.NET) and got the error being mentioned

     Using connection As New SqlConnection("connectionStringName") 
      '// more code would go here...
     End Using
    

    adding a reference to System.Configuration and updating my code as shown below was my solution. The connection string was not the problem since others controls used it without any issues (SqlDataSource)

    Using connection As New SqlConnection(ConfigurationManager.ConnectionStrings("connectionStringName").ConnectionString)
        '// more code would go here...
    End Using
    

提交回复
热议问题