Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/sharepoint/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/unit-testing/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net .aspx页面中的SqlDataSource连接字符串_Asp.net_Sharepoint_Sqldatasource - Fatal编程技术网

Asp.net .aspx页面中的SqlDataSource连接字符串

Asp.net .aspx页面中的SqlDataSource连接字符串,asp.net,sharepoint,sqldatasource,Asp.net,Sharepoint,Sqldatasource,我有一个将ASP.NET页面部署到SharePoint的解决方案,该解决方案在一些页面上使用SqlDataSources。由于在SharePoint部署中,与我们的应用程序(部署到GAC)关联的web.config文件是SharePoint服务器的web.config,因此我们没有对所有环境的完全访问权限来更改web.config文件和添加连接字符串。然后,我尝试使用连接字符串变量创建一个全局密封类,并希望在aspx页面上设置连接字符串。我知道这可以在代码隐藏中完成,但我想知道是否有办法在asp

我有一个将ASP.NET页面部署到SharePoint的解决方案,该解决方案在一些页面上使用SqlDataSources。由于在SharePoint部署中,与我们的应用程序(部署到GAC)关联的web.config文件是SharePoint服务器的web.config,因此我们没有对所有环境的完全访问权限来更改web.config文件和添加连接字符串。然后,我尝试使用连接字符串变量创建一个全局密封类,并希望在aspx页面上设置连接字符串。我知道这可以在代码隐藏中完成,但我想知道是否有办法在aspx页面的标记中设置它

ConnectionString=''
尝试执行上述操作时,我遇到以下错误: 初始化字符串的格式不符合从索引0开始的规范

要在代码隐藏中实现这一点,我需要为每个SqlDataSource声明一个受保护的属性,然后为每个SqlDataSource设置连接字符串属性


感谢您的反馈。

为了访问类属性,您必须在表达式的开头使用=或#声明,即

ConnectionString = '<%# CompanyABCGlobal.DBConnectionString %>'
ConnectionString=''
您可以通过打开来测试它
ConnectionString = '<%# CompanyABCGlobal.DBConnectionString %>'