App.config And Connectionstrings With Several Databases

Nov 20, 2006

Hello all

I need to know the best way to work with databases (Sql Server) in my app.config.

I have an VB application that binds data from a SQL server (All Customers install these application and retrieve data via VPN). I use two databases for each customer. The first DB has some commun tables/data and the second one is its ID (Until now I setup manually the connections because we don't have more that 10 Customers but we need improve that for next year). I know that a connection string is created in the app.config file . 

I don't know if it is possible from this way or if there is another way to do it.... but the goal is:

1. Customer is logged in the application -User Name, ID, Password

2. Customer retrieve a database with commun data and his own database (that is his ID). (From the app.config???) How can I setup my app.config in order that every customer retrieve his database automatically when it is logged?

Thaks, I don't know if it's clear but I didn't find another way to explain my trouble 

View 1 Replies


ADVERTISEMENT

Need Help - ConnectionStrings In Web.config File

Jan 3, 2007

I think I've read to many post and now I'm confused on what the exact syntax should be and where in the web config file for connecting to my remote database on the web. I have a SQL Server 2005 database on the web.  It was imported by the host from the members ID and passwords database created in Express 2005 from the ASP.Net configuration
Here's the portion of the config file:
<configuration>
<appSettings/>
<connectionStrings/>
 
 
<system.web>
Here is the sample connection string my host provided:
DRIVER={SQL Server};SERVER=sqlserver5.loosefoot.com;UID=myadmin;PWD=Your Password;database=eldersmembers
Would someone show me exactly what and where the syntax for the connection string goes?
Thanks in advance

View 8 Replies View Related

Using Web.config ConnectionStrings And SQL Server

Mar 9, 2006

Greetings,
My connection string looks like this (in the web.config) and is used with many data controls in my application:
<connectionStrings><add name="connection_NAH" connectionString="Data Source=NAH;Initial Catalog=NAH;User ID=xxxx;Password=xxxx" providerName="System.Data.SqlClient" /></connectionStrings>
I'm using vb.net and my code looks like this:Dim myConnection As SqlConnectionDim mySqlCommand As SqlCommandmyConnection = New SqlConnection(ConfigurationManager.ConnectionStrings("connection_NAH").ConnectionString)mySqlCommand = New SqlCommand("UPDATE tbMasterOption SET ImageURL = 'test.gif' WHERE ID = 116977")Try            myConnection.Open()            mySqlCommand.ExecuteNonQuery()Catch ex As Exception            Label3.Text = "Couldn't update database record: " + ex.ToString()Finally            myConnection.Close()            Label3.Text = "Closed db connection"End Try
------------------
The only output I get is from the label3 which says "Closed db connection".  Doesn't look like any exceptions are thrown but when I look at the database the record is not updated.  Originally I thought my SQLConnection was not constructed correctly but I also tested it by outputting the connection string to Label3 which looked fine.  The only other thing I can think of is in the use of ExecuteNonQuery().  Is this the right method or do I need something else? Running the sql query manually works...
Thanks in advance..

View 2 Replies View Related

Web.config, ConnectionStrings And SQL Named Instances Over A VPN Connection

Aug 29, 2007

Ok, here's the deal. This has been killing me for months now.

Here's the setup - SQL 2000 database on a Shared Infrastructure (cluster). I have a database on a named instance. My port number is xxxxx. I have dbo (through Windows Auth) permissions on my database. When I connect at the office, I get through fine, no question. When I connect at home, I get error 26 in my asp.net 2 app (using System.Data.SqlClient), cannot find SQL Server database. I can connect through the SQL 2005 Management Studio using the same servernameinstance name I use at the office. I can connect through the SQL 2000 Query Analyzer using servernameinstancename;(semicolon)portnumber. I've tried all sorts of combinations in my web.config -
servernameinstancename,(comma) portnumber
servernameinstancename;(semicolon - causes web.config to blowup) portnumber
ipaddressinstancename, (comma) portnumber

and i still get nothing. usually it's 'error 26' - but if i use this:


Data Source=ipaddressinstancename,portnumber;Network Library=DBMSSOCN;Initial Catalog=xxx;Trusted_Connection=Yes;

I get 'Login failed for user domainuser'

I've tried making an alias. I've tried using ODBC. I've even tried a freakin' DSN. No dice.

Nothing seems to work - I'm at the end of my rope. Can someone please help?

View 4 Replies View Related

SqlSiteMapProvider ConnectionStrings Help!

Apr 20, 2006

When I run my project it fails on SqlDependency.Start(_connect) with message:
An attempt to attach an auto-named database for file D:WINDOWSMicrosoft.NETFrameworkv2.0.50727ASPNETDB.MDF failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.
 
<?xml version="1.0"?>
<configuration> <appSettings/> <connectionStrings>   <add name="SiteMapConnectionString" connectionString="Data Source=.SQLEXPRESS;AttachDbFilename=|DataDirectory| est1.mdf;Integrated Security=True"   providerName="System.Data.SqlClient" /> </connectionStrings> <system.web>    <siteMap enabled="true" defaultProvider="AspNetSqlSiteMapProvider">   <providers>    <add name="AspNetSqlSiteMapProvider" type="SqlSiteMapProvider" securityTrimmingEnabled="true" connectionStringName="SiteMapConnectionString" sqlCacheDependency="CommandNotification"/>   </providers>  </siteMap>  <caching>   <sqlCacheDependency enabled="true"/>  </caching>  <compilation debug="true" strict="false" explicit="true"/>  <pages>   <namespaces>    <clear/>    <add namespace="System"/>    <add namespace="System.Collections"/>    <add namespace="System.Collections.Specialized"/>    <add namespace="System.Configuration"/>    <add namespace="System.Text"/>    <add namespace="System.Text.RegularExpressions"/>    <add namespace="System.Web"/>    <add namespace="System.Web.Caching"/>    <add namespace="System.Web.SessionState"/>    <add namespace="System.Web.Security"/>    <add namespace="System.Web.Profile"/>    <add namespace="System.Web.UI"/>    <add namespace="System.Web.UI.WebControls"/>    <add namespace="System.Web.UI.WebControls.WebParts"/>    <add namespace="System.Web.UI.HtmlControls"/>   </namespaces>  </pages>
  <authentication mode="Windows"/>   </system.web></configuration>

View 2 Replies View Related

&<ConnectionStrings&> Error Message

Apr 12, 2007

I have one SQL Database and I am getting the an error message when debugging.  The error messasge points to the ConnectionString.  Any Ideas would be helpful.
 Rick
<connectionStrings>
<add name="sqloledb" connectionString="Data Source=mssql09.1and1.com,1433;Database=xxxxxxxx;UserID=xxxxxxxx;Password=xxxxxxxx;Trusted_Connection=False" providerName="System.Data.SqlClient" />
<remove name="LocalSqlServer"/>
<add name="LocalSqlServer" connectionString="Data Source=mssql09.1and1.com,1433;Database=xxxxxxxx;UserID=xxxxxxxx;Password=xxxxxxxx;Trusted_Connection=False" providerName="System.Data.SqlClient" />
</connectionStrings>
 

View 2 Replies View Related

When To Code 'providerName=System.Data.SqlClient In ConnectionStrings, Or Not To?

May 31, 2008

Yesterday, in response to an error msg (something like Login failed for user ''), I deleted the 'providerName=System.Data.SqlClient'in my connectionStrings from Web.config.  Then the aspx website worked.I understand that the value "System.Data.SqlClient" specifies that ASP.NET should
use the ADO.NET provider System.Data.SqlClient
when making a connection.  Why deleting providerName solved the error?  Jeffrey 

View 2 Replies View Related

Reporting Services :: Parsing SSRS Config File And Dynamically Changing File Path Of Config File In Code

Sep 2, 2015

Currently have a single hard coded file path to the SSRS config file which parses the file and provides the reporting services web service url.  My question is how would i run this same query against 100s of servers that may or may not share the same file path as the one hard coded ?

Is there a way to query the registry to find the location of the config file of any server ? which could be on D, E, F, H, etc. 

I know I can string together the address followed by "reports" and named instance if needed, but some instances may not have used the default virtual directory name (Reports).

Am I going about this the hard way ? Is there a location where the web service url exists in a table ? I could not locate anything in the Reporting service database. Basically need to inventory all of my reporting services url's.

View 2 Replies View Related

What's The Best Practice...1 Package Many Config Or Many Package W/1 Config

Apr 4, 2007

Hello all,



I'd like to know what's considered a best practice in the following scenario...



We're in the process of converting DTS to SSIS, our current SQL2K setup has one DTS package per database, each database and package are mirror images of each other, with the exception of connection properties and the files path's they pull from. (Occasionally there may be a one off Execute SQL Task that differs from package to package...but this will be handled in a different manner outside of the package from this point on)



From a administration perspective this has been somewhat cumbersome, as every time there is a schema change we need to update the transformations in each individual package...after updating 120 packages my index finger has a bad case of carpel tunnel!



My thought with SSIS is that I can create one package, with many configuration files (one for each database).



Now my question is, 1) is this a good idea? 2) Anytime we create a new database (New Customer = New Database) and need to create a new xml config file, do I have to create the config in BIS/SSIS package then redeploy the package?...or Can I simply add a new config file to the appropriate directory and reference this config in the scheduled job?



Any suggestions are greatly appreciated!



View 1 Replies View Related

Linking Tables From Different Databases Or Querying From Multiple Databases

Dec 10, 2007

Dear Readers,Is it possible, like in Access, to link to tables in other SQL databases that are on the same server? I have a query that I originally had in Access that queered from multiply databases. It did this by having those other tables in the other databases linked to the database that had the query. 
 

View 3 Replies View Related

IIS And The Web.config

Oct 31, 2007

Hi,My application is acting weird and the research I've done leads me to an answer why it's breaking, but not how to fix it.My web app is hosted by a remote company. I have the main website sitting in the root web directory and in a subfolder I have another application that will handle login and updating the content in the SQL 2K5 backend (not an Express DB).The website itself is able to pull in informaiton from the DB without any trouble, so I know it's able to connect to the DB and everything is peachy. The login app though is acting as though it can't get to the DB. I've applied the ASPNET schema to the DB using the aspnet_regsql.exe from the framework and the login application is using the same connection string as the main website.One thing to note here is that the website and the login app have seperate web.config files since they were developed as different projects.With my customized provider defined in the web.config for the login app I get this error on page load:"Parser Error Message: It
is an error to use a section registered as
allowDefinition='MachineToApplication' beyond application level.  This
error can be caused by a virtual directory not being configured as an
application in IIS." If I comment out the custom provider, the page loads but when I try to create a user it tells me that "...the SQL Server couldn't be contacted. This may be because it doesn't accept remote connections." Thing of it is that it's not a remote connection and it's the same connection string and db as the other site.Now, the research I've done points at the two different web.config files, which makes sense. But how do I make the one web.config work for both the website and the subdirectory with the login app? Keep in mind that I can't create any new virtual directories or modify IIS since this is a remote hosting company.Can someone help me understand the fix with a little more clarity? 

View 1 Replies View Related

Config

Mar 30, 2007

Hi,

I'm kind of the first person at my new company to start a project using SSIS. My question(s) revolves around setup and configuration, maybe even best practices.

1. Connection Manager Config - What are some of the methods you use to config your connection managers? I was planning on creating a folder (C:SSISConfig or something) and keeping a config file for each connection there. That way it would be fairly trivial for each developer to also put said folder on there box for deving.

2. Solution set up - Are people creating solutions for each package or just using one Master solution and adding all the packages to that? Or maybe some combination, like having solutions for different areas of functionality or something..? I'm trying to figure out what the pain points are with different approaches.

If you have any other information or horror stories about SSIS that you think might help, feel free to pass them along.

Thanks,

-Ryan

View 1 Replies View Related

SQL Config

Mar 10, 2007

I want to make an application using a distributed database (single logical database, parts of which are located at more than one location or more than one server). It acts as a single collection of data but the database itself is geographically in separate locations.
How do I make it in SQL Server 2005?

View 4 Replies View Related

App.config?

Jul 10, 2006

Hello All,

I am trying to use a custom C# dll from within a script task. The C# dll relies on the Enterprise Library 2.0. Where do I put the enterprise library configuration when I am debugging a package and then when I have the package in production. I cannot find any documentation anywhere on this.

Thanks for any help,

Justin

View 5 Replies View Related

Service Broker Not Working For Restored Databases (SQL 2000 Databases Restored On 2005)

Jan 24, 2006

I just restored my SQL server 2000 database on the SQL server 2005. after this i ran the Service broker sample ("Hello World") on this database by changing the AdventureWorks name to the new database name. The "setup.sql" runs fine. When i run the "SendMessage.sql" i was not getting any rows in the output (The message was not getting inserted into the queue). I checked the Service broker is enabled on this databased using the query "select is_broker_enabled from sys.databases where name = 'newdbname' " It was 1. I even tried the ALTER DATABASE SET ENABLE_BROKER. but it didnt work.

When i tried the sample on a newly created database it worked fine.

Is there any solution to make the restored database to work for service broker.

Thanks

Prashanth

View 3 Replies View Related

Web.config File Example

May 24, 2007

Does anyone have an example of a web.config file that works with Dynamic Data controls?  I asked because I can't seem to arrange my "config sections" in any working order. I use 1 connection string in the web.config to establish a conversation with the database.   Thanks in Advance. 

View 1 Replies View Related

How To Access Web.config

Nov 15, 2007

I am using vs2005 and have a solution file with 4 projects, 2 of which are presentation layers (admin sections), 1 is a business logic layer, the other a data access layer.
The data access layer project is simply a class library that will provide data access functionality.  Im using a dataset (xsd) to create my data access objects.  My question is how do I select a connection string from the web config file (which is in each of the presentation layer projects)  as the data access layer is a class library there is no web.config.  Using the connection string selector in the dataset wizard doesnt show any available connection strings.

View 1 Replies View Related

Web.config File

Feb 21, 2008

 Hi the data connectionstring will be generated automatically in web.config file after dragging a data table from database into webpage.for example: <configuration> <add name="SQLProfileConnString" connectionString="Data Source=.SQLEXPRESS;AttachDbFilename=|DataDirectory|MSPetShop4Profile.mdf;Integrated Security=True;User Instance=True"   providerName="System.Data.SqlClient"/> </> But what if I have to write the connectionString part myself, I mean where I can get  the syntax of it? Thanks a lot 

View 1 Replies View Related

SessionState In Web.config

Nov 21, 2003

When I connect locally, my app runs fine. But when I try to connect via FTP to a dedicated server, I can't connect at all. My connection string is in the web.config file. I noticed that the sessionState in web.config is automatically generated with the standard sa blank pwd. I still can't connect even when I change this to the correct uid and pwd. Does anyone know what I need to do? My conn string's data source is "." Please help.

Thank you,
Tina

View 22 Replies View Related

Get ConnectionString From Web.config

Apr 6, 2006

I've defined my connection string in the web.config file:
<add name="RealtorXConnectionString" connectionString="Data Source=localhostSQLExpress;Initial Catalog=RealtorX;User ID=sa;password=welcome" providerName="System.Data.SqlClient" />
Now I want to get that string and use it in some code where I'm going to run a query against the database.  This query happens in PageLoad, and won't be bound to any UI component.   How can I replace XXXXX below with the value stored in web.config?
Dim strConnection As String = XXXXX
Dim cn As Data.SqlClient.SqlConnection = New Data.SqlClient.SqlConnection(strConnection)
cn.Open()

View 4 Replies View Related

DTEXEC /Config

Aug 6, 2007

This was directly from BOL.

/Conf[igFile] filespec

(Optional). Specifies a configuration file to extract values from. Using this option, you can set a run-time configuration that differs from the configuration that was specified at design time for the package. You can store different configuration settings in an XML configuration file and then load the settings before package execution by using the /ConfigFile option.

Does this mean that I can specify which configuration file to use during runtime?
Or is just because I'm too desperate for that, I understood that way

Thanks

View 14 Replies View Related

Get SQL Connection For SQL Config From XML

May 30, 2007

Hi

In toder to make my SSIS packages portable, I need to be able to set connection string to sql package configuration. I thought I can do that via XML package, problem is, at execution time SQL server package configuration is queried first, then variables from XML.
This way, I have no chance to set connection via XML.
Any ideas on how to aproach this ?
(I want to have as much configuration on SQL server so I can modify it easily from future GUI application.

best regards

View 4 Replies View Related

What Happens To Config On Import?

Feb 19, 2008

I have a simple SSIS Package where the Connections are specified in Configuration files, which was built locally and I wanted to deploy it to a server. Looking at the different options I decided to try the "Import Package..." from Management Studio (SSMS), since I have limited access to the server (and no access to the file system). It does appear to have imported the package from the local file system to the servers "SSIS Package Store".

My question is, what happened to the Configurations files when a package is imported?

When I "Run Package" from SSMS, the Execute Package Utility shows Connection Managers with only part of the connection info, but it executes just fine. Also, it shows no Configurations at all.

My impression is that during "import" the connection managers are created from a snapshot of the current Configurations, so what ends up in SSIS are static connection managers, not Configurations. However I can't seem to find any documentation one way or the other. Also, I suspect that the only reason the partial connection info actually works is due to dtexecUI (?) running locally under my own account.

Any information is greatly appreciated.

Thanks

View 3 Replies View Related

Config File Is Ignored

Mar 25, 2008

I have a simple SSIS package which includes one Analysis Services Processing Task. I have created a connection manager object (cmo) and assigned it to the AS task. Within the cmo I selected a specific user name and
password to log on to the server with. Tested this [domain][user account] and it works. Now here is the problem. When I run the package either in debug mode or from a command line, the packages ignores the connection manager and
attemps to use the account I am logged into the server with.

Using a config file to hold the credentials does not work either. When DTEXEC is used, the package attempts to use the credientials used to log in to the server.


Does anyone have any ideas why this is happening?

View 4 Replies View Related

XML Config File Gets Ignored

Dec 12, 2007

Hi All!

I've been struggling with a problem I have. When I use DTEXECUI to run a package and manually add the config file, it gets ignored and there is no warning as such.

Here's the set up:

1) create SSIS package that uses a DB connection
2) enable config, add XML config, export the connection string, disable config
3) edit config file, change connection string
4) open package from Windows Explorer (double click)
5) add config file created in step 3

All of that works fine, but there are times when it doesn't. I think it depends on the editor used in step 3. If I use textpad and "pretty format" the XML (from the huge one-line built from within Visual Studio), then sometimes the changes aren't picked up. I can tell this because the "default" server in development is not accessable in production. When we "reformatted" the XML back to one line, the correct server was connected to.

I have no idea what the problem with the formatted XML was. I thought it was CRLF vs LF, but I have at least one config that formatted that way and it works fine. My current thought is character encoding when using TextPad.

My biggest problem is that DTEXECUI doesn't tell you that the config file isn't going to be used. It just ignores the "bad" config format and goes on its merry way using the information in the package itself. That really scares me.

Has anyone else seen this? What is the problem being introduced into the config file?

Thanks,
Frank

View 3 Replies View Related

Pckg Config.

Jul 10, 2007

Hi,



I have configure our ssis project that will take the connection string from the database

but when i change the connection string so the pckg will take the data from another server with exact tables name it fails.



what do you think the problem is ??



View 7 Replies View Related

XML Config Files

Mar 30, 2006

I am new to SSIS. I created a XML configuration file for my package. I found lots of data on how to do this but I can't find anything on how to get the values back out. I am trying to get them out in a Script file. Any help and maybe examples would be appreciated.

View 4 Replies View Related

Config Error

Nov 23, 2006

I get this error. Does any body came across this and found some solution?





Compiler Error Message: CS0433: The type 'Microsoft.Web.UI.ScriptManager' exists in both 'c:WINDOWS.000Microsoft.NETFrameworkv2.0.50727Temporary ASP.NET Fileswebsites_hrdbms3acda2bba63d28c5assemblydl332deaeca05606e1_3759c601Microsoft.Web.Atlas.DLL' and 'c:WINDOWS.000assemblyGAC_MSILMicrosoft.Web.Extensions1.0.61025.0__31bf3856ad364e35Microsoft.Web.Extensions.dll'




I have created the application with ATLAS July CTP . currently upgraded to ASP.NET AJAX BETA 1. I face the above problem

View 1 Replies View Related

SQL Command Timeout In Web.Config

Dec 27, 2006

Hi,
Can the DB CommandTimeout property for SQL be added in web.config for a project globally? Currently, I am changing the property before each call, but if I can add a value in web.config that would make things more efficient.
Thanks

View 1 Replies View Related

Web Config Connecting To SQL 2000

Feb 11, 2007

Hi all,
 I'm having a frustrating time connection to SQL 2000 from the web.config. I'm getting the following error
 Here is my config
<?xml version="1.0"?><configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0"> <appSettings/> <connectionStrings> <add name="ConnectionString"      connectionString="Server=xxxx;Database=xxx;uid=xxx;pwd=xxx;"      providerName="System.Data.SqlClient" />   </connectionStrings> <system.web>  <compilation debug="true" strict="false" explicit="true"/>  <authentication mode="Windows"/> </system.web></configuration>
This is the error i get
 An error has occurred while establishing a connection to the server.  When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
Any thoughts?
Thanks.

View 3 Replies View Related

Connection Strings In Web.config

May 31, 2007

What am I doing wrong?
This works:
SQLConn.ConnectionString = "Data Source=McD_DB;Initial Catalog=McDFeelGood;User ID=uuu;Password=ppp"
Now I want to put it in my web.config, but these don't work ("ConnectionString property has not been initialized"):
SQLConn.ConnectionString = ConfigurationSettings.AppSettings("McDFeelGoodConnectionString") (VS IDE says this method is obsolete)SQLConn.ConnectionString = System.Configuration.ConfigurationManager.AppSettings("McDFeelGoodConnectionString")
<connectionStrings>    <add name="McDFeelGoodConnectionString" connectionString="Data Source=McD_DB;Initial Catalog=McDFeelGood;Persist Security Info=True;User ID=uuu;Password=ppp" providerName="System.Data.SqlClient" /></connectionStrings>

View 1 Replies View Related

Web.config Configuration For SQL Express

Jun 30, 2007

Hi
I installed on my XP machine iis and, SQL express and visual web developer.
now I need to configure the right parameters in the web.config file. (it was easy on SQL2000)
can anyone explain how to configure the web.config (in DNN 453) ?<!-- Connection String for SQL Server 2005 Express -->
<add
name="SiteSqlServer"
connectionString="Data Source=.SQLExpress;Integrated Security=True;User Instance=True;AttachDBFilename=|DataDirectory|Database.mdf;"providerName="System.Data.SqlClient" /><!-- Connection String for SQL Server 2000/2005
<add
name="SiteSqlServer"
connectionString="Server=(local);Database=DotNetNuke;uid=;pwd=;"
providerName="System.Data.SqlClient" />-->
</connectionStrings><appSettings>
<!-- Connection String for SQL Server 2005 Express - kept for backwards compatability - legacy modules --><add key="SiteSqlServer" value="Data Source=.SQLExpress;Integrated Security=True;User Instance=True;AttachDBFilename=|DataDirectory|Database.mdf;"/><!-- Connection String for SQL Server 2000/2005 - kept for backwards compatability - legacy modules
<add key="SiteSqlServer" value="Server=(local);Database=DotNetNuke;uid=;pwd=;"/>
 
Please assist.
thanks
 

View 1 Replies View Related

SQL Mirror Issue- Web.config

Oct 24, 2007

 
I've setup  sql mirroring which works fine. my problem is that when the mirror takes over from the partner that means the IP address of the SQL server has changed which is coded into the web.config file.
 
How can I get my web.conig file to recognise 2 sql servers that are being mirrored so it can see whichever one is the principal.
Currently, when the mirror takes over my web application does not work as the IP address of the sql server has changed.
Does anyone know the fix for this?
thnaks

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved