Define connection strings in sharepoint

sriyan

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. ?

Alex H

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.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Losing connection to SharePoint issue

From Dev

SharePoint Lists Connection to Tableau

From Dev

WP 8.1 app connection to SharePoint

From Dev

comparing strings in MACRO define

From Dev

Define strings and draw language

From Dev

define variable by concatenating strings

From Dev

Connection strings and configuration manager

From Dev

Display connection strings

From Dev

SSIS parametrize connection strings

From Dev

Encrypt connection strings

From Dev

Connection Strings and Configuration Files

From Dev

MVC Connection Strings/LocalDb

From Dev

Manually define db connection in laravel

From Dev

Define connection string without dependencies

From Dev

MongoDB PHP define database connection

From Dev

how to define strings in xcconfig and quotes

From Dev

How to define combined Strings in resources?

From Dev

define flavor and buildtype specific strings

From Dev

SSIS -Sharepoint List Source Dynamic connection

From Dev

Securing PDO connection strings for MySQL

From Dev

Create Connection Strings with the Factory Pattern

From Dev

Transform odbc connection strings to SqlClient

From Dev

How to define connection string for session state in Azure

From Dev

Is it good or bad to store the DB connection details with define()?

From Dev

Is it ok to define PDO db connection in function?

From Dev

Can I define a port for an outbound connection

From Dev

iOS #define or static const for global strings

From Dev

Where to define long message strings with parameters

From Java

TypeScript: Define a union type from an array of strings