.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Change Dynamic Data database connection string

Posted By:      Posted Date: October 18, 2010    Points: 0   Category :ASP.Net

I have recently started to learn Dynamic Data Web application.

I have built a Dynamic data Website with LINQ data access layer. When the LINQ data context was built over an existing SQL2005 database, the connection string for that database was correctly, automatically, placed into the Settings and .edmx Code for the project. It works, but it's a "static" connection string.

I would like to be able to use this one LINQ data access layer against both test and production databases without having to manually change and recompile the project's connection string each time.

Is there a way to pass/change the User connection string to the LINQ data access layer at Run Time so that destination database changes? Ot in Other words How can user can choose a database from a list of databases.


View Complete Post

More Related Resource Links

Need Oracle Data Provider .CS File for Oracle 10g Database connection !



I need a 'Wrapper.cs' file which takes care of the Database connection ( Oracle 10g) where

i can just call the method with my SQL Query


Gridview1.DataSource = SampleWrapper.ExecuteDatatable("THE SQL QUERY");


Plz Post the link if there is any open source !    

How to change connection string of a pivot table pointing to SSAS 2005 cube using excel 2003?

Hi All,I am not sure if I should have posted this query to Excel 2003 forum. But posting it here as it applies to SSAS 2005 as well.Ok, let me give the background before I tell the actual problem.We have users on ABC domain and the SSAS server is also on ABC domain. Users on this domain can acess the excel pivots by connecting to cube to browse the data. They leave the Userid & password field blank while they setup the connection string and it works fine. Thanks to windows authentication that takes the credentials of user logged in. Let's say I have two users A and B, they login to ABC domain with their own windows ids.  Now when user A creates a excel file having a cube pivot and then sends this file to user B, user B can refresh and modify the same excel file (he can select new measures to pivot, new hierarchies in filters and so on).Now, let's say I have another user, user C. He has excel 2003 installed on his PC and cannot migrate to excel 2007. He is on different domain XYZ but have a valid windows userid on domain ABC. The domain ABC & XYZ can not be setup to have trusted relationship. Now, when user A sends the same excel file to user C. When user C opens the file and try to refresh it or try to modify the pivot by selecting/deselecting any elements, he gets below error prompt:" An error was encountered in the transport layer." and "Errors in the

Change connection string of Linq to Sql entities

Hi all.I have a solution which uses Linq to SQL Data Classes to acced the db. I have a project for my domain objects in my solution, which is a class library and has the dbml file. When I set up the dmbl using the wizard, Visual Studio created an app.config file on that project with the connection string. It also creatting a settings file with the same info. I've noticed that if I change the connection string in the settings file, the app.config gets updated, which is the expected behaviour.However, I'm having a problem when I deploy my web site to the production server. I already set the app.config file's Build Action to "Content", and also set Copy to ouput directory to "Always". Nevertheless, when I install the web site and change the connection string in the app.config file, it still takes the old connection string, so obviously I get an error. I've found that it only works if I change it with in Visual Studio and then compile, but of course that's not an optimal solution, because any change in the production db server would mean I have to change my project's assembly, thus generating a new version.Any thing I'm missing? What do I have to configure so that the assembly takes the connection string form my app.config file directly after I deploy?Thanks a lot.

how to change the web application Database connection form Windows authentication to SQL Server acco

Hi, I have a web application created and Database connection authentication was given as Windows authentication. how can i change it to a SQL server account in MOSS 2007. Thanks in advance.

A connection cannot be made to the database. set and test the connection string


Hi All,

i have configred SSRS with Sharepoint integration mode everything was successfull. Now when iam trying to create sample report which pulls the data from lists. i have done the below steps.

1) Business Intelligence Projects -> Report Server Project
2)Right-click on Shared Data Sources and select Add New Data Source
 General tab
 Name: DataSource1
 Type: Microsoft SQL Server
 Connection String: http://localhost:3000/_vti_bin/Lists.asmx?op=GetListItems

 Credentials Tab
 Selected radio button: Use Windows Authentication(Integrated Security).
Clicked Ok.

3)Right-Click on Reports (New item-> Report)
4)Dataset: selected new dataset
 Query Tab
 Name: DataSet1
 Datasource: Datasource1(as above)
 Command Type: Text
 <Method Namespace=http://schemas.microsoft.com/sharepoint/soap/ Name="GetListItems"/>   <SoapAction>http://schemas.microsoft.com/sharepoint/soap/GetListItems</SoapAction>

 Parameters tab:

I need a dynamic connection string for my windows forms application.


Hello folks


I am brand new to forms applications and visual studio 2008 I am building a forms application to connect to a 3rd party's sdf file. There is no password or username required to connect however the 3rd party app installs the sdf in the users folder for me I am on windows 7 but I have clients on xp.


I went to add a data connection and chose sql ce file and browsed out to my location and it connects and works. But I need this connection string to be for whoever is logged into there laptops or computers no matter the operating system version xp,vista,7.


Data Source=C:\User\username\AppData\Roaming\PS\GES\surve.sdf


Can someone tell me how to do that. Also please explain in words a new borne could understand cause like I said I am new to this.


Thank you


Change Default Sort for Dynamic Data Web Application




I just created a dynamic data web application and setup a simple .EDMX file. Next, I created meta-data / partial classes to ensure that my integer identifiers wouldn't show up:

// ...


public object TableId { get; set; }

 // ...

I wanted to now set the up the list pages so they sort using a different attribute ("Name" in this case). Anyone know if this is possible / how to do it?






How do I change what Data ASP.NET dynamic data gets from the DB?


I want to lock down the data that ASP.NET DD gets from the database based upon who is logged in.

Is there a standard or recommended way to filter the data that DD pulls from the database based upon a session variable or something like that?

i.e. I only want to get data from table A where the user logged in has permission to get the data from table A (table A has a relationship to my users table)

SSIS as data source in SSRS connection string


I have a connection string

="/f c:\test\test2\test2\package.dtsx /set \package.variables[User::varfil].Value;" & Parameters!varempid.Value

but its not returning any results. I need a valid connection string.

Is a Dynamic Config Possible for SSAS BIDS Projects? (Data Source / Connection, and Deployment Targe


How do we automate SSAS Project configs such that (a) RDBMS data source server (connection) and (b) SSAS deployment target server are dynamic? 

As it stands, just before I script the ASDB (for deployment/promotion from Dev to QA, or QA to Prod, for example), I use BIDS designer interfaces to change the source connection and deployment targets, then script the ASDB. 

Is there a more dyamic alternative?  Perhaps something analogous to SSIS package configurations?  I can't believe that everybody is doing this as manually as I've done.

Is There Other Methods to Create and INSERT data into A SQL Database besides ADODB.Connection


OK - I have everything working on my Production computer to find out that when I upload my page to my Shared Hosting Server, to find out my application will not work because I do not have high enough permissions to for aspcompat to be true.

This works on my development server which of course I have full access to:


        'Creating Connection Object and opening the database
        con = Server.CreateObject("ADODB.Connection")

        'Done. Close the connection
        con = Nothing
        Response.Write("Your Information was Successfully Added.")


Is there another method to execute my  sql string (which contains my INSERT INTO statement, and is in my .vb code file ) with just a Medium Access Level?  Other wise I will have to purchase a Dedicated server, which currently I can not really afford!


LINQ data source control and db connection string


I have designed a few pages which use LINQ datasources and Gridviews to maintain data.

I have built a data layer which happily uses System.Web.Configuration.WebConfigurationManager.ConnectionStrings("myConnectionString").ConnectionString

However, the LINQ data source controls use Settings.designer.vb MySettings class definition which is auto generated and doesn't except the above Connection string.

Any ideas?

SSAS Deployment Wizard - Data Source connection string userid and Password getting removed



I have an SSAS database (Analysis Services 2005) which connects to Oracle for the data. I have the userid and password
saved in the connection string.


If I deploy the cube from Visual Studio I DON't have to manually edit the Data Source in the server to input the userid and password. The information is retained.


If I do a build and then deploy .asdatabase file using Deployment Wizard (Microsoft.AnalysisServices.Deployment.exe), the connection information dissappears. I have "Remove Passwords" = False in Project configuration. So when you build the project there will be a file with extension .assecurityinformation which holds the encrypted security info. Somehow

deployment wizard doesn't look at this file.


After the build I execute this command

Microsoft.AnalysisServices.Deployment.exe  .\Project.asdatabase /s:.\Deployment.log

I tried interactively and silent mode. Either way I cannot deploy the project with the userid and password in it.

Any clue?

Connection String issue: Keyword not supported: 'data source'.


I have three connection strings for my web application (ASP.Net) as MVC2 provides by default.

Bar the locations and the names, the syntax is identical, but in the second connection string, it keeps returning "Keyword not supported: 'data source'." EVEN THOUGH IT'S IDENTICAL. D:

Please help! I've tried changing the Syntax to include a "Metadata" tag, still didn't work!

how to change database connection of infopath datasource



my question is. i have created a form with a sql server database connection. now if i want to open these form on another machine, with the same database but another server name

how can i change the database connection for the datasource for this form?

thank you

Configurable connection string/data source for CE 4.0


I'm using CE 4.0 in a Silverlight app and my connection string  is:

Data Source=C:\MyApp\MyApp.Web\App_Data\MyAppDB.sdf;Password=***********;Persist Security Info=True

I don't want a hard coded file path in the connection string. Is it possible to make this configurable, or determine directory its located in at runtime?

Dynamic Data Templates in GridView ASP.NET 3.5

At a high level, Dynamic Data Templates can be seen as a system to very quickly build up a User Interface linked with the relevant data model, immediately enabling you to perform CRUD operations (Create, Read, Update, Delete) on the database using the specified data source. They provide a powerful method for building up these kinds of applications, and I'm going to focus on an overview of what Dynamic Data Templates actually are, and a few ways of customizing them to suit industry needs.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend