FAQ Database Discussion Community


Splitting DataAccess and Service Layer. Missing ConnectionStrings and References

c#,entity-framework,connection-string
I am new to .net development and I am still facing some issues regarding the design of my solution. As mentioned in another question of mine, my entire solution is currently split into 3 projects: 1) DataAccessLayer - Implements an Entity Framework. All the entities are defined here. A DataAccessContext...

SQL Server connection string with “$” in password

powershell,sql-server-2012,connection-string
I have a connection string to a SQL Server 2012 DB: $CONN_STR = "Server=SERVER;Database=mydb;User ID=myuser;Password=abc1$4def;" I'm creating a connection in PowerShell, but the login fails due to invalid password. I know that the password is correct and validated that in SSMS. I've tested with another account and from what I...

Make connection string ADO.NET

c#,database,connection-string,oledb,sql-server-express
How can you make a connection string for an OleDbConnection? I have tried a lot of combinations and variants, but nothing works. I use a MS-SQL platform with C# to make the connection for SQL EXPRESS. Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\Data\Northwind.mdb;User Id=admin;Password=; Data Source=(local);Provider=SQLOLEDB;Initial Catalog=FastCycle;Integrated Security=true Persist Security Info=False;Data Source=Northwind;Integrated Security=SSPI;Trusted_Connection=TRUE;providerName=System.Data.OleDb Provider=SQLOLEDB;Data...

c# - Entity Framework ConnectionString won't update after changing App.Config in runtime

c#,entity-framework,entity-framework-6,connection-string,app-config
I'm developing a WPF application which depends on Entity Framework for data access. At the first time installation I need to create a new connection string based on the User input, then updating App.Config according to that. The problem is: after updating the App.Config file, Entity Framework doesn't detect the...

Connecting to database using Windows Athentication

sql-server,vb.net,authentication,connection-string
I would like to use window authentication in my program to connect to my sql server. users already have certain permissions on the SQL server and I would like to leverage that in my program. The way I currently connect to the server is using this connection string. Dim ConnectionString...

where to put Entity Framework configuration strings in a WebAPI application

entity-framework,asp.net-web-api,connection-string,configuration-files
I have started a WebAPI application using VS empty application template. First, I have added the WebAPI service functionality - no issues. Now, I need to add Entity Framework functionality, and I'm facing the following issue: I do not have an App.config file in my application. Where can I put...

Entity Framework Seeding with SqlCeBulkCopy returns error

c#,sql-server,entity-framework,sql-server-ce,connection-string
I'm trying to seed my database with ~50K entries. I have two databases. The 50K entries will be generated by some queries/calculations on database2 (Database2, based on Database first approach) and will then be inserted into database1 (Database1, based on code first approach). The process is relatively slow, even with...

Connection String throws Null Reference Exception?

c#,asp.net,.net,azure,connection-string
I'm trying to connect Microsoft Azure's Database using my ASP.NET but my connection string throws a Null Reference Exception during runtime. The Connection String is correct (I got it off MSDN and added my account details to it). Here's the connection string in the Web.config file: <configuration> <appSettings> <add key="StorageConnectionString"...

Setting an ODBC connection string in VBA

excel,vba,odbc,connection-string
I have created a macro that sends a new CommandText to an ODBC Connection in my Excel spreadsheet and then refreshes the table of results associated with the query. This has been working fine, but I've noticed that each time I run the macro it overwrites the connection string with...

AdoNetAppender get connectionstring value from another file

c#,.net,connection-string,log4net,adonetappender
I have multiple web services that currently logs their info\error messages using log4net into file. I want the logging now to be done in DB. I've read about AdoNetAppender and I can see that given some parameters such as command text and connection string it can be easily done. BUT...

ASP.NET connection string to local SQL Server database, using web.config

asp.net,sql-server,connection-string
Why is System.Data.SqlClient.SqlConnection class throwing an exception that "The parameter is incorrect"? I'm attempting to learn how to set up database connections using a local SQL database and an ASP.NET MVC project, using .NET framework 4.5. Here are the steps I've taken that lead up to this: Created a new...

StackExchange Redis ConnectionString

connection-string,stackexchange.redis
What is the full format of the ConnectionString used in StackExchange.Redis? I have searched but cannot find documentation for it....

Why am I getting “The magic number in GZip header is not correct.” error using OWIN auth against Azure SQL

asp.net-mvc,entity-framework,azure,connection-string,owin
Nothing on Google or SO relates to this specific problem, so asking a new question. I created a brand new Asp.Net MVC Web Application with the standard user-security option. I also created an empty database in Azure. I did nothing but change the default connection string to this: <connectionStrings> <add...

Azure Website Exception: Format of the initialization string does not conform to specification starting at index 0

entity-framework,connection-string,azure-web-sites
I have an Azure Website that I use to host my MVC + Entity Framework project. When I run the site locally using the same connection to my SQL Azure database, everything works perfectly, but when I deploy the site to my Azure Website, I get the following error: Format...

The ConnectionString property has not been initialized error with VB.NET

vb.net,runtime-error,connection-string
I am trying to fill a datagrid with data from access, but every time I run this program i get an error saying ConnectionString property has not been initialized i have tried everything i know. Can someone please help Private Sub RefreshData() cnn = New OleDb.OleDbConnection cnn.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\My_db.accdb"...

App Config Connection String Not Updating For Service

c#,web-services,connection-string,app-config,nlog
I have created a webservice with an app.config which is holding my connection string. Everything works perfectly and as expected, apart from that when I change the connectionstring to point to a new table the service will continue to point at the old address (even when I switch the service...

Is this connection string for SQL Server 2012 correct?

sql-server,connection-string
I have this connection string, and I'm not sure if it's correct: <connectionStrings> <add name="SomeName" providerName="System.Data.SqlClient" connectionString="Data Source=MCA\SQLEXPRESS;Initial Catalog=SomeName; Integrated Security=true; ID=sa;Password=testtesttest;" /> </connectionStrings> Before this I was making the connection with Windows Authentication, and this connection string worked for me: <connectionStrings> <add name="SomeName" providerName="System.Data.SqlClient" connectionString="Data...

Code-first MVC 4 using Entity Framework and SQL Server 2012

sql-server,asp.net-mvc,login,connection-string,code-first
This question is not about SQL Server "3xpr355" (the obfuscation in quotes is by design; it should prevent future searches from hitting dead-ends, as mine have done). I am using code-first and Entity Framework to develop an MVC 4 application. The SQL Server, IIS, and Visual Studio are all...

SQL Connection String Error: Unable to connect to any of the specified MySQL hosts

c#,mysql,connection-string,mysqlconnection
I have been trying to get my program to connect to my database for the last 4 hours but I can not get it to work. I am writing a WPF desktop application which needs to connect to a database to save user created content. I have the database created...

Passing Connection From TableAdapter Produces connectionstring property has not been initialized

c#,connection-string,sqlconnection,tableadapter
I ran into a problem where passing a connection from a TableAdapter to some methods throws an exception stating the connectionstring isn't initialized. There are quite a few questions on SO with this exception but none were passing the connection and most were because the ConnectionString was null. Weird thing...

Database connection not working - System.Data.SqlClient.SqlException: No process is on the other end of the pipe

c#,.net,connection-string,sqlexception
I am trying to connect to a database on my local machine, but keep getting an error. This is just for a school project, but I can't seem to figure out where I am going wrong. I reviewed a lot of other answers, and tried what they suggested, but have...

“login failed for user” when connecting to database through javascript

javascript,sql-server,connection-string
My web page has some links and radio buttons. Selecting a particular link and radio button combination, and then clicking on "Get Results" button would run the query. But I am getting the below error: Login failed for user 'dev\rahulsingh' Below is a sample code: runThisQuery = "select * from...

Format of the initialization string does not conform to specification starting at index 165

c#,database,entity-framework,connection-string
I keep getting this error: Format of the initialization string does not conform to specification starting at index 165. and I can't seem to find the problem . connection code : <connectionStrings> <add name="DefaultConnection" connectionString="Data Source=(LocalDb)\v11.0;AttachDbFilename=|DataDirectory|\LarandeModulDB.mdf;Integrated Security=True" providerName="System.Data.SqlClient" /> <add name="LarandeModulDBEntities"...

ADODB Connection is empty, Unable to read CSV file

sql,vba,connection-string,adodb,recordset
I have gotten the code below working with all file types except CSV Files. I am trying to copy a CSV file into a worksheet and I have gotten myself confused. All help will be appreciated. The debugger shows: rsConn = "" szSQL = "SELECT * FROM export.csv" When I...

Connection String not working, cannot read file location

sql,sql-server,database,connection-string
private void button1_Click(object sender, EventArgs e) { SqlConnection con = new SqlConnection("Data Source=(LocalDB)\v11.0;AttachDbFilename="c:\users\skofiar\documents\visual studio 2013\Projects\Diploma_Project\Diploma_Project\STD_IBU.mdf";Integrated Security=True;Connect Timeout=30"); SqlDataAdapter sda = new SqlDataAdapter(@"SELECT Student_ID, Name, Course_ID, Course_Name, Study_Program FROM Students CROSS JOIN StudentCourse", con); DataTable dt = new DataTable(); sda.Fill(dt); dataGridView1.DataSource = dt; } This part of the code shows...

connectionString outside SQL server with App.config file

c#,sql-server,connection,connection-string,app-config
I have a console application and in the App.config I need to add a connectionString to another SQL server that is in the same network. If I try the connectionString to a local server by only passing the Server='localhost' its worked but I cannot make it work for an outside...

Unsure how to set C# Connection string depending on solution configuration

c#,mysql,visual-studio,connection-string
I'm trying to figure out how to use Solution Configuration Management in Visual Studio to set a MySQL Connection string depending on what build configuration but am fairly new to this. I've found plenty of info on the XML for the App.config file for creating connection strings, but am unclear...

SQOOP connection-param-file format

hadoop,parameters,connection-string,sqoop
In Sqoop for Hadoop you can use a parameters file for connection string information. --connection-param-file filename Optional properties file that provides connection parameters What is the format of that file? Say for example I have: jdbc:oracle:thin:@//myhost:1521/mydb How should that be in a parameters file?...

How to solve SQL connection string issues?

mysql,vb.net,connection-string
I'm experienced with both VB.NET and SQL, but I've never worked with both at the same time before. I've found dozens of online tutorials, most of which contradict each other and none of which I can get to work. I now have a sizable project on the brink of completion...

C# WinForm application - How to save connection string (SQLite)

c#,winforms,connection-string,privileges
I have a winform app in .NET 4.0 with database (SQLite). I need to add an option for user to be able to change the path to the file containing the database - in short, to change the connection string. I used app.config to save connection string like this: <connectionStrings>...

Error while connecting to sql through windows authentication

c#,connection-string
I am using the following code to connect to sql throgh windows authentication. string connctionstring = "connectionString={0};Database={1};Integrated Security=SSPI;"; string _connctionstring = string.Format(connctionstring, datasource, initialCatalogue); SqlConnection _connection = new SqlConnection(_connctionstring); _connection.Open(); But i am getting the following error. Help please.I am able to login through sql server. ...

connectionStrings in app.config at compile time

c#,wpf,msbuild,connection-string
I'm working with a WPF application, and I have a connection string with hardcoded database parameters in my app.config file. What happens to this app.config at compile time? Is this packaged with the rest of my application? Is there any security vulnerabilities to having the hardcoded username/password for the database...

How do I connect to a .sdf local database file in C#

c#,.net,entity-framework,sql-server-ce,connection-string
I am using local SQL Server CE database file (.sdf) and Entity Framework for my task. I have created my models and now entity framework should map them to local database. I have this code in my Main method which inserts some data to database(to check): var db = new...

connectionString defaulting to production database.. Entity Framework

entity-framework,asp.net-mvc-4,connection-string
I am learning asp.net mvc 4 on top of entity framework. There is a project at work I took over and I am trying to centralize the connection credentials depending on the environment (dev, test, prod) the application is in. Currently I have the connectionstring dynamic, but for some reason...

Persist Security Info Property=true and Persist Security Info Property=false

c#,database,ms-access,database-connection,connection-string
For the properties: Persist Security Info=true and Persist Security Info=false Can you tell me what is the difference between them, and if I don't put it in my connection what will happen? connect.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0; Data Source=C:/Users/Nourah/Downloads /Phase3/Salary.accdb; Persist Security Info=False;"; ...

Asp.net MVC 4 dynamic connection string

asp.net-mvc-4,dynamic,connection-string
I am learning Asp.net mvc 4 at work and modifying an asp.net mvc 4 project. Currently, the connection to the database is set in the web.config of each project. The project uses entity framework which I am also still trying to understand (I come from a java Apache Wicket background)....

How to insert data into SQL Server database by VB.Net in windows application

c#,php,vb.net,connection-string
How to insert data into SQL Server database by VB.Net in Windows application. I am using the Windows form application. At run time it gives exception that: con.open() the connection is not established. code: imports system.data imports system.data.sqlclient on button_click(){ Dim cn as SqlConnection=new SqlConnection("Data Source=.\sqlexpress;InitialCatlog=shri;Security=True;User id=---;password=system") cn.close() cn.Open() Dim...

SQL Server Error “Named Pipes Provider: Could not open a connection to SQL Server [53]”

sql-server-2008,connection-string,named-pipes,sql-server-config-manager
I used to have a desktop application pointing to a Sybase database through an .ini file that had this connection string: CONNECTION_NAME = "DSN="Dna_Name";UID="User";PWD="Password"" It worked perfectly. A few days ago the database has been migrated to SQL Server 2008 R2 and I need to update the .ini file to...

Dynamic connection string to Web Api

asp.net-web-api,entity-framework-6,connection-string
I am exposing my repository operations through web api. Repository has been implemented with Entity framework and Unit Of Work Pattern. I have many instances of the same database. Each one represent the data of a different Client. Now the issue is how can I set the connection string dynamically...

Connection property has not been initialized when filling a DataSet

asp.net,connection-string,server-error
So here is my issue: Currently I am trying to make a report that will show 1st and 2nd shifts, by multiple days... So if they select the range 6/02 - 6/04, I am running a query 3 times... once for 6/02, 6/03, and 6/04... Also they can select shift,...

How does AttachDbFilename work?

c#,asp.net,asp.net-mvc-5,connection-string
This may be a stupid question. But I have to ask. I'm making an ASP.NET MVC 5 application with EF code-first. I can't understand how AttachDbFilename work. Does this create and attach a database to database instance? Or does it just attach an existing database? Do I really need to...

Castle Windsor / ActiveRecord / NHibernate: How to intercept/modify connection string

c#,nhibernate,connection-string,castle-windsor,castle-activerecord
I have consolidated the connection string information for a number of C# .NET solutions that are in my possession. Previously, each project was storing its connection string in its own format, requiring me to modify several files for each installation of the software. Only one remaining solution is giving me...

ASP.NET connection string to SQL Server

asp.net,sql-server,connection-string
Well I was developing an ASP.NET webforms app in Visual Studio and it worked well. It has 2 SQL Server connection strings, one for ASP.NET Identity and the other for my own tables. Then I wanted to test my app on a real server. So I changed the connection strings...