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
在sharepoint中定义连接字符串_Sharepoint_Sharepoint 2010 - Fatal编程技术网

在sharepoint中定义连接字符串

在sharepoint中定义连接字符串,sharepoint,sharepoint-2010,Sharepoint,Sharepoint 2010,我是sharepoint的新手。我正在尝试使用SPSqlDataSource连接到sharepoint Web部件中的SQL数据库。代码运行良好。但是我需要设置连接字符串,而无需参考web.config 是否有一种方法可以在sharepoint中的变量类型中定义它,这样用户就可以在UI中定义connectionstring,而无需编辑web.config文件 如果您想为每个Web部件都执行此操作,您可以执行以下操作 例如: [WebBrowsable(true), WebDisp

我是sharepoint的新手。我正在尝试使用SPSqlDataSource连接到sharepoint Web部件中的SQL数据库。代码运行良好。但是我需要设置连接字符串,而无需参考web.config


是否有一种方法可以在sharepoint中的变量类型中定义它,这样用户就可以在UI中定义connectionstring,而无需编辑web.config文件

如果您想为每个Web部件都执行此操作,您可以执行以下操作

例如:

    [WebBrowsable(true),
    WebDisplayName("Connectionstring"),
    WebDescription("The connectionstring."),
    Personalizable(PersonalizationScope.Shared),
    Category("YourCategory"),
    DefaultValue("")]
    public string Connectionstring { get; set; }
它将显示为SharePoint选项。
但我认为有更好的解决方案,因为你必须为每个Web部件设置它,用户需要编辑Web部件的权限。

Thanx。。。之前不知道自定义属性。。。这个很好用。