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

谁说我不能喝 提交于 2019-11-29 13:42:27

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)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!