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

后端 未结 1 1983
予麋鹿
予麋鹿 2020-12-20 14:56

I am using Microsoft Enterprise Lip I I have this method to Insert resource in the website I get this error down i don\'t think it is permission problem and really i don\'

相关标签:
1条回答
  • 2020-12-20 15:52

    This usually means your connection string isn't any good. If you look at the stack trace, you'll notice that this is failing when trying to interpret your connection string.

    Check your connection string to make sure it is correct - or post it here for help (but without any sensitive information such as passwords ;) )

    UPDATE

    According to the SqlDatabase documentation the SqlDatabase class takes a connection string, not a key to the connection string configuration.

    So

    new SqlDatabase("SiteSqlServer");
    

    Should be

    var connection = ConfigurationManager.ConnectionStrings["SiteSqlServer"];
    
    Database objDB = new SqlDatabase(connection.ConnectionString);
    

    (I have omitted any defensive code here for brevity)

    0 讨论(0)
提交回复
热议问题