connection-string

Where to store DB connection string for Excel 2007 Template App Connection to SQL Server Database?

I have a legacy Excel 2007 Template that has hardcoded Ms Access MDB path in the VBA code used to connect to the Access tables and save, retrieve data. I migrated the MS Access Database over to SQL Server with Integrated Authentication for the Excel 2007 Template Users. My question is, What is the Recommend Way / Best Practice for stor...

How does the .net SqlConnection object check that a connections string is syntactically valid?

System.Data.SqlClient.SqlConnection foo = new System.Data.SqlClient.SqlConnection(); foo.ConnectionString = "Data Source=myServer;Integrated Security=SSPI;"; // exception thrown on this line If I declare a new SqlConnection object in my .net code and then set the ConnectionString field to a syntactically invalid connect...

How do I register a DbProvideFactory?

I am trying to create a new ADO.NET connection string using the 'Add Connection' dialog. I click the 'Change' button to change the selected 'Data Source' but can't see the desired data source in the list of registered data sources. Now, I know I need to update the machine.config file 'DbProviderFactories' element with the appropriate e...

Connection to SQL

I want to add a connection to a sheet so that each time a cell is refreshed, a value is passed in from SQL. I want it to reference a textbox on one of the other sheets for where ID = How do I set the connection to refresh with that value. What do I put in my connection string? I can get it to work staticly. ...

What is wrong with this mysql connection string?

I am using this connection string, <add name="connectionString" connectionString="server=10.1.1.16;user id=root; password=lmslive; database=lmslive; pooling=false;" providerName="MySql.Data.MySqlClient"/> and this database lmslive is in a system next to mine connected via proxy.... And i executed this query on that system, G...

Time out exception in 1st run for local DB

My connection string is like the following. It shows 'Timeout Exception' first time I run the application. But, for the subsequent run, it's ok. I think, it might take some time to attach the DB to the SQLExpress Server. Is there anyway to increase Timeout period? Thanks I am using SQLServer 2005 Express and VS 2008 and .Net 3.5. ...

How to make a Front Office + Back Office websites + Windows Service to share the same ConnectionString

I want to make a Front Office, Back Office and a Windows Service to take the Connection String from one place. I tried to use System.Configuration.ConfigurationManager.ConnectionStrings["SqlServerDatabase"].ConnectionString; but this works only for websites, the connection string is take from web.config For Windows Service, I tried Sys...

Possible to set default schema from connection string?

With SQL Server 2005 and 2008 is it possible to set the default schema from the connection string? It'd be a lot easier if we didn't have to manually set the schema with SQL code. ...

Can't pull out the connection string from the configuration manager

I know I just missing something simple, but when I try pulling the connection string from the ConfigurationManager, I always get null. I have System.configuration added as a reference In the source file I have using System.Configuration; using MySql.Data; using MySql.Data.MySqlClient; .... _connStr = ConfigurationManager.ConnectionStr...

SQL connection string for database on network

I want to connect to a database on a host except localhost, my DBMS is SQL Server and I'm using ado.net, like this: SqlConnection con = new SqlConnection(constr); con.Open(); SqlCommand cmd = new SqlCommand("insert into st (ID,Name) values ('"+cnt.ToString()+"','havijuri');", con); //some sql commands. con.Close(); what should I use a...

Extract a specific portion of connection string

Hello, Any way to extract what's after the @(if any) and before the next . (if any)? Examples: host host.domain.com user@host first.last@host [email protected] [email protected] I need to get host in a variable. Suggestions in Python? Any method is welcomed. Thanks, EDIT: I fixed my question. Need to match host and h...

ConfigurationManager - How to use connection strings with .NET 3.5?

Hi All, I see a very good post here about what I am wanting to do, http://stackoverflow.com/questions/1831291/net-3-5-to-read-connectionstring-from-app-config It says to use the ConfigurationManager class. I cannot reference the ConfigurationManager class. If I look at the system.dll that I am using (which is v2.0.50727) there is no ...

Where do you store your connection strings?

In all my VB6 applications, connection information was stored in encrypted fields in the database. Nobody has access to the database and if anyone did, all they would get to see was a bunch of encrypted values. There was always a flaw with this method. Fetching the connection information required using a hard-coded id/password in the ap...

Integrated windows authentication to SQL Server

Hi, I have an application that uses a database on SQL Server and I want users to connect to that server using integrated windows authentication. The connection string is: SqlConnection scn = new SqlConnection("Data Source='server name';Initial Catalog=temp;Trusted_Connection=true;Integrated Security=SSPI"); When I run the application...

Connecting to database in ASP.NET server control

As a follow on from this question I'm building a custom server control to be placed on a Sharepoint 2010 master page. The idea behind this is that it will display a menu that is dynamically populated from the database. As this is a server control, I'm building it in a dll but I've run into a small snag. As it has to connect to the data...

Sql Server Catalog/DB pointer --

I have a production server and I standardized the names of all the DBs on the server to projectName.whatever The problem is I have one database named projectName_logging I want to rename it to projectName.Logging (OCD a bit?) The problem is there are connection strings that all say projectName_logging. Is there a way to sa...

Why does the "Reset Pooled Connections" option not work for MySQL .NET Connector

I'm using the latest version (6.2.3) of the net connector. According to the documentation an option exists called "Reset Pooled Connections". I have tried to disable this using the following connection string: Data Source=DB;Database=DBName;UID=username;PWD=password;Max Pool Size=100;charset=utf8;Reset Pooled Connections=no; I have ...

how do I setup the Connection String where I only change it one place?

How can I make the code string connStr = ConfigurationManager.ConnectionStrings "staceys_cakesConnectionString"].ConnectionString; work generically and not need the staceys_cakesConnectionString? Or how can I set it somewhere else so I only have to change it one place when I change it? using System; using System.Collections.Gene...

What is the default username and password of my SQL Server Express?

It installed automatically with Visual Studio 2010 Ultimate. I didn't create any users for the server or ANYTHING. I'm using: string connectionString = @"Server=.\SQLEXPRESS;Database=SportsStore;Trusted_Connection=yes;"; I get error that authentication failed. So the server is being found, but my credentials are wrong. What would the...

using a SQL database in multiple projects

I have a system comprising 5 applications. Each app accesses a database via a DAL library. In the DAL i have an app.config with the following entry: <connectionStrings> <add name="DataAccessLayer.Properties.Settings.ConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=c:\users\something\something\MyDB.mdf;Inte...