Question

First, I quite apologize to you for my poor English (cause I'm french). My problem is that, I need to recover some data like server IP, user name and password witch was get back by the user in some input on submit and use these data for change the connectionString witch is in web.config. But I don't know how to do.

I hope to have been clear and thank you in advance for your help.

Was it helpful?

Solution

Well, after a lot of search and work, I have chose to change my connectionString like it:

@{
    Layout = "~/_Layout.cshtml";
    Page.Title = "Dossier Racine";
    var srv = Request.QueryString["server"];
    var usr = Request.QueryString["username"];
    var pwd = Request.QueryString["password"];  
    var db = Database.OpenConnectionString("server="+srv+";database=ReportServer;uid="+usr+";pwd="+pwd+"","System.Data.SqlClient");    
    var sqlFile = " SELECT *"
        + " FROM Catalog";
    var selectedData = db.Query(sqlFile);    
 }
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top