Click here to Skip to main content
15,886,199 members
Everything / Connectionstring

Connectionstring

connectionstring

Great Reads

by #realJSOP
This library is intended for use in a multi-environment system, but it certainly be used under less stringent environmental confines, even down to a single desktop machine taht needs to connect to a single database server.
by ASP.NET Community
In my case, I use  a FileUpload Control(Id:->FileUpload1), an ImageButton(ImageButton1) or you can use the Image,  a Button Control(Id:->Updatebttn)
by CognitiveFeedback
Retrieve Connection String from user using Common Data Link dialog.
by ASP.NET Community
The AccessDataSource class is a data source control that works with Microsoft Access databases. Like its base class, SqlDataSource, the

Latest Articles

by #realJSOP
This library is intended for use in a multi-environment system, but it certainly be used under less stringent environmental confines, even down to a single desktop machine taht needs to connect to a single database server.
by Yamin Khakhu
Encrypting the configuration in Web.Config
by ASP.NET Community
In my case, I use  a FileUpload Control(Id:->FileUpload1), an ImageButton(ImageButton1) or you can use the Image,  a Button Control(Id:->Updatebttn)
by ASP.NET Community
Encrypt & Decrypt ConnectionString SectionSometimes we need to secure ConnectionString to prevent anyone can knows it. whatever your purpose from

All Articles

Sort by Score

Connectionstring 

9 Mar 2021 by #realJSOP
This library is intended for use in a multi-environment system, but it certainly be used under less stringent environmental confines, even down to a single desktop machine taht needs to connect to a single database server.
2 Mar 2014 by ASP.NET Community
In my case, I use  a FileUpload Control(Id:->FileUpload1), an ImageButton(ImageButton1) or you can use the Image,  a Button Control(Id:->Updatebttn)
28 Oct 2015 by Zoltán Zörgő
Wait a second.1) IIS does not connect to any RDBMS, except for storing session state - it is only a setting you can use in your application2) SQL Express does not enable TCP/IP connector by default, you need to enable it[^].3) For this to work, you need to have specific port level...
21 Feb 2016 by OriginalGriff
First off, for production you shouldn't be using (localDB) - you shoudl be using the actual name of the SQL server instance that your hosting provider has set up for you.And secondly, attaching a DB is a bad idea in a web environment - you are much, much better off creating the DB in the SQL...
15 Oct 2012 by I.explore.code
Generally, the rule is to open the SQL connection as late as possible and close as quickly as possible. Preferably you should open/close connections only the Data access layer i.e. the class(es) that directly access the data and no where else. What you can do is create a singleton connection...
17 Dec 2012 by Zoltán Zörgő
As I see, you came from a scripting world (php?), since you do database stuff like there.First of all, it depends on the driver and the connection string you use, how the exact connection object is handled. As there is an underlying layer (mostly unmanaged code), and connection creation is...
11 Mar 2013 by littleheartzzz
ok i found out it was not because of the connection string, there is a different setting for different versions of iis -->
26 May 2013 by Varun Sareen
Dear Friend,You can Add the files as a link to the file to one of your projects.Use Add an Existing Item to the project you want to add the file to - the Open button has a small down arrow, if you click that you can select Add as Link.This will add the file as a link from the...
24 Jun 2013 by Ron Beyer
If you are accessing the system from a Windows Forms application, then I would say yes (with the caveat of asking HostGator directly) you have to white-list them.Most providers only allow the database to be accessed from its domains. This is because they are meant to be the data back-end to...
16 Aug 2013 by André Kraak
Should string not be with a capital S - String[^].
19 Nov 2012 by pykos
Hello!I have a question about how to change between test and production databases in a windows forms app. So I built an app that inserts cerain values in a test database (reads someting from an xml and writes the resoults in the DB). I access the database thrugh the dataset(I draged the...
1 Sep 2014 by ♥…ЯҠ…♥
Hi Rajan,First of all you should set the connection string in the App.Config file. For example I set the connection string for my database as you see here:
24 Jun 2014 by Raul Iloc
1.It is indicated to not mix Data Access Layer with User Interface Layer, so you should keep all data access code and associated database file in separate assembly (DLL). If you want to access the database from your UI you should do it indirectly by invoking methods from your Data Access...
11 Jul 2015 by Suvendu Shekhar Giri
Update:Please ignore this solution . The question itself was not clear. I apologise for messing up the things.First of all, rename your string variable to something else than 'var' because in C# it has a different meaning. Also need to keep the value within a pair of quotes.You may do...
2 Nov 2015 by Andy Lanng
If you have copies the database from your machine to another you may need to change the security.Bizarrely, if the target server has the same login credentials as the newly attached database, they do not sync. You have to remove the previous credentials and add them back from the server...
16 Dec 2015 by phil.o
SQL Server default port is 1433, not 1443. You're having a typo in your connection string.Moreover, what is the Class variable you are using in your try..catch block? Shouldn't it be the config variable here instead?The error message seems to indicate that the config.getUrl() method is...
9 Jan 2016 by Richard MacCutchan
Not sure what an MDF file is, but you can generally find the answer to this question at ConnectionStrings.com - Forgot that connection string? Get it here![^].
9 Jan 2016 by Dave Kreskowiak
You can't. An .MDF file can only be attached by a single instance of SQL Server Express at a time, or whichever local server you're using.If you need to "share" that file among multiple instances of your application you need a single SQL Server to host the database. All of your application...
21 Jan 2016 by Brian Lace
looks like a file system permission issue
6 Oct 2016 by DRD94
At the moment I am storing my connection strings in my app.config file in plain text. Bad practice, I know, and I am trying to encrypt them instead. I've referred to https://msdn.microsoft.com/en-us/library/ms254494(v=vs.110).aspx and haven't had an issue with getting the app.config part working...
28 Dec 2016 by OriginalGriff
Your connection string looks very wrong: you are saying that you want Integrated Security, but then you supply a - very dangerous - user name "sa" and a - probably invalid - password of blank.Getting a valid connection string is pretty simple: try setting up a connection in VS with the...
11 Oct 2017 by OriginalGriff
Try: strSQL = "select * from dbo.[!Lotti]"
13 Oct 2017 by OriginalGriff
Web.config If you hard code the string you have to recompile the code when it changes. And it changes every time you do maintenance, or upgrades. Because if it doesn't, your code tests against the production database and everything you do risks disaster. If you forget the WHERE clause for an...
25 Aug 2018 by Dave Kreskowiak
That should be an older style (Access 2003 and older) database. It normally uses the JET engine, not ACE, though ACE may still be able to open it though. Provider=Microsoft.Jet.OLEDB.4.0;Data Source=path to database.mdb; or Provider=Microsoft.ACE.OLEDB.12.0;Data Source=path to database.mdb; Of...
26 Jul 2020 by oronsultan
Hi Guys, I have a sln in .Net which is based on 2 projects: - Wpf application under the name 'Installer' and a class library under the name 'InstallerCore'. - The 'InstallerCore' is responsible for accessing the data base and basically it is...
3 Apr 2023 by Graeme_Grant
You are using MVVM. You can use DataBinding to track selection. 1. Wrap the Model: public class CheckItemModel : ObservableObject { private bool isChecked; public bool IsChecked { get => isChecked; set => Set(ref...
22 May 2023 by George Swan
My suggestion would be to add the appropriate connection strings to appsettings.json so that the last lines read something like this "AllowedHosts": "*", "ConnectionStrings": { "CustomerOneConnection": "Data...
6 Jun 2023 by PIEBALDconsult
I recommend something along these lines: string server = null ; // Fetch from configuration string database = null ; // Fetch from configuration System.Data.SqlClient.SqlConnectionStringBuilder constr = new...
4 Oct 2012 by ernieball_26
I want to know if it is possible to decrypt "DataProtectionConfigurationProvider" which is responsible in encrypting the connectionString in the web.config file. I am not the one who developed the system that is why I need to know the decrypted value. I have been searching for solutions or...
4 Oct 2012 by Member 7713647
I recommend you to look at www.asp.net/videos. They have many videos that can help you out. I recently watched a video on how to encrypt and decrypt configuration data such as connection string, etc...
4 Oct 2012 by Sandeep Mewara
I believe it should be '-pd' instead of '-pef' for decrypting. Refer: MSDN: How To: Encrypt Configuration Sections in ASP.NET 2.0 Using DPAPI[^]MSDN: How to: Decrypt a web.config File[^]UPDATE:Refer: Encrypting Configuration Information in ASP.NET 2.0 Applications[^]--...
15 Oct 2012 by Ganesh KP
Hi friends, I have one web service in which I have 3 vb.net modules1. ApplicationManager.vb 2. AgencyManager.vb3. InventoryManager.vband my service InventoryService.asmx in which I call the GeAllAgencies in the ApplicationManager.vb and in turn that method calls the GetAgency in...
17 Oct 2012 by mmd20092010
how to change connection string entity framework in runtimecode in my appconfig file :
17 Oct 2012 by Rohit Shrivastava
You can create objectcontext based on dynamic connection string if you use the non-default overloaded constructor. Keep the format of connection string in appsettings and change the datasource dynamically and create your ObjectContext, till the time schema remains same it will work...
30 Oct 2012 by Ed Gepulle
Unable to open the physical file "D:\_Web3rev\App_Data\dbStudent.mdf". Operating system error 32: "32(The process cannot access the file because it is being used by another process.)".An attempt to attach an auto-named database for file D:\_Web3rev\App_Data\dbStudent.mdf failed. A database...
30 Oct 2012 by Ed Gepulle
I am using DefaultAppPool application pool in my local IIS and the identity is NETWORK SERVICE. I tried creating another instance of login in another directory and it works but in this instance it failed and receiving the above error message. my windows authentication has nothing to do with this...
30 Oct 2012 by Ed Gepulle
Can somebody share his comment about my topic? its a connection string to my sql database. i can explain further.this is the true error that apppears:[SqlException (0x80131904): Unable to open the physical file "D:\_Web3rev\App_Data\database.mdf". Operating system error 32: "32(The...
30 Oct 2012 by Ed Gepulle
further:Line 29: sds.SelectCommand = "SELECT * FROM [myTable] WHERE [username] = @username AND [password] = @password";Line 30: Line 31: DataView dv = (DataView)sds.Select(DataSourceSelectArguments.Empty); -->> this is the errorLine 32: tryLine 33: {
30 Oct 2012 by Ed Gepulle
after doing some changes in my IIS this is the error:Cannot open user default database. Login failed.Login failed for user 'IIS APPPOOL\DefaultAppPool'.
3 Nov 2012 by ShacharK
Hey,I was wondering whether there is a way to benefit the integration with the Windows Azure publish profiles and use the connection strings within them statically within my code.I mean that I would have to refer, lets say, some collection or some XML stuff, and while deploying my code...
20 Nov 2012 by Mohd. Mukhtar
Hi,Use the below technique to do the same.public static string GetConnectionString(){ #if (DEBUG) return testConnectionString; #else return productionConnectionString; #endif}To change the mode follow the below step.1. Right click on root...
20 Nov 2012 by Guptha Ch
Save both Connection strings of the databases in the web.config App.config file using Cofiguration Manager.based on your requirement use the if condition to assign Connection string to the SqlConnectio object.
17 Dec 2012 by singping
I have a part of code as following and it keep showing an error "The connection was not closed. The connection's current state is open." at the cmd2.Connection.Open(); after debugging. so I'm wondering how can i solve this problem if i using multiple connection? Please someone assist me for...
17 Dec 2012 by OriginalGriff
Because you are using the same connection for cmd and cmd2, you do not need to open it again when you set up the sql2 command: SqlCommand cmd = new SqlCommand(sql, connection); cmd.Connection.Open(); SqlDataReader ddlValues; ... ...
23 Dec 2012 by hamid65215
hii use this code for connect to the SQL Server in my domain network connectionString="server=192.168.0.13,1433;Network Library=DBMSSOCN;Initial Catalog=RayanehSanatPB;User ID=sa;Password=123456;" providerName="System.Data.SqlClient" />i have one sql server 2008 and...
23 Dec 2012 by Zoltán Zörgő
- Check if tcp/ip is enabled for the server instance- Check firewall- Use a network tool (like Network Monitor) to catch the connection failure on tcp or ip level- This connection string is useful in special cases[^], you should use the general connection string syntax[^] (PS: never use...
9 Jan 2013 by Steen Hulthin Rasmussen
You can configure your connection string and other settings as a part of the azure web sites environment. You do this in the configure tab under the web site.Here are two blog posts describing how to do (its for php, but it is pretty much the same for...
17 Jan 2013 by fjdiewornncalwe
If you are trying to use a central database for multiple instances of the application, then using Access is a really bad way to go.The correct solution would be to use a SQL Server instance on the machine hosting the database. If you don't have licensing for SQL Server you could always use a...
17 Jan 2013 by ACE_
Just Share your folder databaseand change path other user...like this...Dim MDBConnString_ As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\\172.16.0.233\DatabaseFolder\DatabaseName.mdb;"
22 Jan 2013 by melvintcs
im developing a winform and i store my connection in App.configand this is how i call the connectionString from C#string CS =...
22 Jan 2013 by Zoltán Zörgő
You shouldn't store and access your connection strings this way.Do it as suggested by Microsoft: http://msdn.microsoft.com/en-us/library/ms254494(v=vs.80).aspx[^]
27 Jan 2013 by christine tan
Hi guysi am inserting a string and a int into a database. There is no error but the code below didn't work. i am thinking it is the connectionstring which work on my WPF application. Can you please advise me on what went wrong. TIA! :Dstring a = textBox1.Text; string b =...
27 Jan 2013 by Anurag Sinha V
Hi,Nothing looks suspicious in your code except for the ConnectionString...What does AttchDbFileName do??Anyways you might want to try a normal ConnectionString as below:connectionString="Data Source=MY-PC;Initial Catalog=Sample; Integrated Security=trueLet us know if it...
27 Jan 2013 by furqanAshraf
Debug your code with a break point. I hope that will help you in correcting connection string when you actually got the error. Other wise its is fine.also try this SqlCommand comm = new SqlCommand("INSERT INTO Video VALUES('" + (a + b) + "'," + l + ")", con);instead of SqlCommand comm =...
27 Jan 2013 by christine tan
I have solve it, the problem lies on the database. i have change the database to sql server 2008 instead of the one in visual studiothanks everyone for your help :D
27 Jan 2013 by guruprakashc
SqlCommand comm = new SqlCommand("INSERT INTO Video VALUES('" + a + b + "',1)", con);
10 Apr 2013 by CognitiveFeedback
Retrieve Connection String from user using Common Data Link dialog.
19 May 2013 by MJ MOUSAVI
I have a c# application with sql server 2008 database in windows authentication mode. when i run it in my system it works well.But when i share c# app in network, I can not connect to database and i get error( a network related or instance...).this is my connection string:conn = new...
19 May 2013 by Johnny J.
Try replacing "localhost" with the IP address of the machine:conn = new SqlConnection(@"Server=XXX.XXX.XXX.XXX;Database=OfficialAutomation;Integrated Security=true;");I assume that the user that is logged in can access the machine on the network?Otherwise, you might want to switch to SQL...
26 May 2013 by ♥…ЯҠ…♥
Hi Friends,I have three projects in the solution, in which I have web.config in one solution.Now I want to read connection string from web.config from one project to another project.Please help me in this regardsAny help will be greatly appreciated.Thanks RK
28 May 2013 by Gokhan CETIN
Hi,I'm trying to get parent thread name/info in child thread. I want to do that; My classes need to use parent thread info for connect to database. My application running multithread and each threads classes connecting diffrent connection string. So when my parent threads create sub thread,...
28 May 2013 by Sergey Alexandrovich Kryukov
Threads don't have names. To best of my knowledge, parent-child relationships between threads are not generally preserved by the OS. They are hosted by a certain process, of course. In other words, threads of the same process are equal in their relationships, no one is known to be a parent or a...
24 Jun 2013 by Julio Zuart
Hello everyone! This is my first question ever so I hope I do everything correctly. Please feel free to provide feedback on how to use the community website since I'm eager to learn.I am about to complete an application that runs different databases, 2 locals within the client computer, and...
3 Jul 2013 by Jitendra Ku. Sahoo
Hi,Is it possible to find who altered last time a particular ROW of a table last time ?Is it possible to find who are the user logged into database and executed some SP last time ?Is it possible who are connect to LIVE database from LOCAL system on a particular day ?Many many Thanks
3 Jul 2013 by OriginalGriff
Assuming that you don't mean to record the information yourself, but want SQL server to do it for you, have a look here: Auditing in SQL Server 2008[^] - it may not be exactly what you want to know, but it shoudl at least get you up to speed with want questions you need at ask!
3 Jul 2013 by Zukiari
Hi,You can add two extra columns in table which will capture the last modified user and last modified time. You have to pass the logined user name and updated time to the data base while updating the table.Thank You
3 Jul 2013 by Zukiari
Hi,You can add two extra columns in table which will capture the last modified user and last modified time. You have to pass the logined user name and updated time to the data base while updating the table.Thank You
8 Jul 2013 by LordVovin
Hi all,I have problem with my sql connection, or sql port. I would like to connect with my VB.net application to sql database placed on my server (external machine). Normally, when I'm connected to normal net - everything works great. But when I'm trying to connect with the application to...
16 Aug 2013 by bhawin parkeria
string^ constring=L"datasource=localhost;port:80;username=root;password='';";MySqlConnection^ conDatabase=gcnew MySqlConnection(constring);MySqlCommand^ cmd=gcnew MySqlCommand("select * from eventor.user",conDatabase);MySqlDataReader^...
25 Aug 2013 by alifat92
i'm trying to write Connectionstring to Web.config like this: and read from it like this:string strcon =...
16 Sep 2013 by OriginalGriff
A config file can contain many connection strings - all you need is a separate setting for each, or a single setting, and concatenation characters. You can then split the separate settings using the string.Split method.One way to do it would be to store your strings...
25 Sep 2013 by R K
I have tried to use as many connectionstrings as possible but still getting this error ,when working with Excel(.xls) using ADO.NET Error- "Could not find installable ISAM"Connection string code used:- string filename = @"d:\test.xls";string Connectionstring =...
25 Sep 2013 by Rick van Woudenberg
You could try :string cnStr = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\Docs\\Book2.xlsx;Extended Properties='Excel 12.0 xml;HDR=YES;'";you could also try to put single quotes around the datasource :string co = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source='" + filename +...
11 Oct 2013 by ASP.NET Community
The AccessDataSource class is a data source control that works with Microsoft Access databases. Like its base class, SqlDataSource, the
11 Oct 2013 by ASP.NET Community
Encrypt & Decrypt ConnectionString SectionSometimes we need to secure ConnectionString to prevent anyone can knows it. whatever your purpose from
12 Dec 2013 by Ali_100
Provider=Microsoft.Jet.OLEDB.4...
12 Dec 2013 by sajid hassan
Hi All,I am using an excel Sheet to show data in form of pivot tables. Since data is going to be huge i am connecting to SQL Server directly to get data from a stored proc. Everything is working fine however i want to hide the user name and password from users.can you suggest me how to do...
12 Dec 2013 by Maciej Los
Please, read my comment first.As far as i know there is no method to "hide" options of connection (password and user name). You can write macro to do create pivot table in MS Excel and then to remove connection:Creating PivotTable Reports and Charts with VBA in Excel 2010[^]Macro to...
12 Dec 2013 by Maciej Los
Remove IMEX=1 from the end of connection string.For further information, please, see: http://www.connectionstrings.com/excel/[^]
21 Feb 2014 by Member 10609511
Hi everyone,Basically I want to display data from two tables in my database within Visual studio 2010 into one data gridview. Just a brief background to my project - it is a website where users can upload content(Images and video). I have three tables - one table 'Incident' stores the...
21 Feb 2014 by Sandip.Nascar
You have several options here - 1. If you have links between the tables, use a query with join and make a one datatable to view it in one grid view2. If there are no relations at all between tables, I don't see any reason to use one grid view to show all the 3 tables. Create a link at the...
21 Feb 2014 by Peter Leow
I figured that you want to display username (available in user_acc table) and business name (available in business table) along side related data from incident table in one gridview. then you got to join the 3 tables like this, assuming that you have a user_id field and business_id field in the...
21 Apr 2014 by Fazlan85
I am creating multi DB application from Access DB's. Using a Open dialog box I need to update the connection string DB file path for the access DB. This does not work and gives the error: No error message available, result code: DB_SEC_E_AUTH_FAILED(0x80040E4D). But when I declare a string...
21 Apr 2014 by Aravindba
Hi Declare this after u get path in DUP1 DataRow t; j = s.Rows[0]; x = s.Rows[1]; t = s.Rows[2]; DUP1 = j.ItemArray.GetValue(1).ToString(); //here u declare string and create oledbconnection.what u try before u getting valule for DUP1 u...
24 Apr 2014 by kool15th
my application is in windows form(c#) which needs multiple insertion(say 500 times in one go) in sql server 2008 database.I am destroying the command objects, connection objects. It works fine for some occurrences but than it hangs. what more can be done to make it more effective. if a pause...
24 Apr 2014 by Pranav-BiTwiser
Connection pooling refers to the task of grouping database connections in cache to make them reusable because opening new connections every time to a database is a time-consuming process. Therefore, connection pooling enables you to reuse already existing and active database connections,...
24 Apr 2014 by Fazlan85
Hi all I solved it.I did something like this..private void Form1_Load(object sender, EventArgs e) {static string dup = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + DUP1 + ";Jet OLEDB:Database Password=1010101010 "; OleDbConnection db = new...
29 Apr 2014 by ZurdoDev
http://msdn.microsoft.com/en-u...
23 Jun 2014 by OriginalGriff
Try setting up a connection in VS with the Server Explorer pane:1) Open Server Explorer.2) Right click "Data connections" and select "Add connection"3) In the dialog that follows, select your DataSource, and database, specify the security info, and press the "Test connection" button.4)...
23 Jun 2014 by Jafarinejadvazifehkhorani
as guys said go to this linkhttp://www.connectionstrings.com/sql-server-compact/[^]it seems that you need to use following lines to get the right db connection stringstring StartupPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase);string...
23 Jun 2014 by Member 10409338
Hi, i have encoutered following problem.I have asp.net application named "Blog" and DLL with database named "DataAccess". DataAccess is referenced to Blog.The Connection String that works and is located in Blog looks like:
17 Jul 2014 by Member 10914759
I have written a WCF service with database connection in Visual Studio 2012. When I deploy the database on my server I get a The server encountered an error processing the request. The exception message is 'Instance failure.'. See server logs for more details. error.I followed the steps from...
17 Jul 2014 by Maciej Los
First of all, check connection string: http://www.connectionstrings.com/sql-server/[^]You need to properly setup SQL Server to enable tcp/ip or named pipes connections.See:...
27 Aug 2014 by Member 11040863
I'm trying to make a program in Visual Studio using asp.net that displays the results of a SQL Database in an HTML repeater table. I'm attempting to filter the data within the table so that you are able to display members who are "termed" or members who are "active".Here is my code so...
27 Aug 2014 by Rajiv Gogoi
Simply put HTTP 414, the error message you are getting is self explanatory "The request URL is too long". Can you check whats so long in the url that the limit is crossed.
2 Sep 2014 by Marc Koutzarov
Create somewhere a central web service and and send it to the application encrypted (use asymmetric encryption). But I'm afraid it will not help you much because if someone uses a debugger he could easy grab the decrypted key from memory. Take a look at this namespace ...
31 Jan 2015 by mahdisadigi
im new in asp.net please help me to solve this errorthis is my web.config
1 Feb 2015 by SrgjanX
hi guys, i need to connect to oracle database with c# application trough tunnel,with the tunnel, in the connection string i need to connect to localhost:9090, but whatever i try to connect the application is trowing error at connection.Open(); function.usings: using...
14 Feb 2015 by Johnny5er
Im working on a team project which was created in Visual Studio MVC with MySql. When testing everything locally it was fine. When i was ready to go live, i deployed the app through GitHub, everything went good, but just no data.I was using a local connection string with user=root and...