I'm new to sharepoint. I'm trying to connect to a SQL Database inside a sharepoint webpart using SPSqlDataSource. Code is working well. But I need to set the connectionstring without refering to the web.config
Is there a way to define it in a variable kind of thing in sharepoint, so that user can define the connectionstring in the UI without editing the web.config file. ?
If you want to do it for every WebPart, you could do a Web Part with a custom Property.
For example:
[WebBrowsable(true),
WebDisplayName("Connectionstring"),
WebDescription("The connectionstring."),
Personalizable(PersonalizationScope.Shared),
Category("YourCategory"),
DefaultValue("")]
public string Connectionstring { get; set; }
It will show as a SharePoint-Option. But i think there are better solutions out there, because you will have to set it for every WebPart and the user needs the permissions for editing webparts.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments