+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / MSSQL Database

MSSQL Database

2 posts, 0 answered
  1. Greg Campbell
    Greg Campbell avatar
    1 posts
    Registered:
    30 Dec 2009
    30 Dec 2009
    Link to this post
    Very nice web system, I am impressed. I have worked with many application but but they were not able to use MSSQL.
    This was an easy installation as well. Thank you..

    Now for the question. I have MSSQL 2005 installed with several databases on it (Including the web database). I would like to have the web access all of these databases from a login screen for each one and display this data and query them. Do you have a module that can assist? or some other system were this can be done?

    SrRupert
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    30 Dec 2009
    Link to this post
    Hi Greg Campbell,

    It will not be possible to set the database which will be used upon login. There are many places in the web.config file where the DataAccess default connection is set. In all providers - Membership, role, profile, GenericContent providers there is a property that sets the connection string which is used to query a certain datatabse. What you can do is changing the connection string and set the project to point to a different database before you login. Below is a sample code

    protected void Page_Load(object sender, EventArgs e)
       {
     
     
    protected void Page_Load(object sender, EventArgs e)
       {
           btnSubmit.Click += new EventHandler(btnSubmit_Click);
           if (Page.IsPostBack == false)
           {
               myConnectionString.Text = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["Sitefinity"].ConnectionString;
     
           }
       }
     
     void btnSubmit_Click(object sender, System.EventArgs e)
           {
     
               Configuration conf = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("~");
               conf.ConnectionStrings.ConnectionStrings["Sitefinity"].ConnectionString = txtConnectionString.Text;
               conf.Save();
     
     
           }

    Kind regards,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
2 posts, 0 answered