connection-string

What is the connection string for localdb for version 11

徘徊边缘 提交于 2019-12-17 03:07:37
问题 I'm trying to do the Code First Walkthrough of the entity framework ( http://blogs.msdn.com/b/adonet/archive/2011/09/28/ef-4-2-code-first-walkthrough.aspx ). I have the latest SQL Server Express and when I check my versions available via command line ( sqllocaldb info ): I see localdbApp1 and v11.0. When I try to run the walkthrough with a few minor tweaks, I get a can't connect error. My app.config looks like this: <parameter value="Server=(LocalDB)\v11.0; Integrated Security=True;

How to get connection string in class library project

不羁的心 提交于 2019-12-14 03:48:36
问题 In my .net solution, I have two different projects: An MVC core web application project and a class library project. In web application project, database connection string is in appsettings.json file. I would like to access that connection string from class library project. Is it possible? If yes, how? If there is any better approach to get connection string, please let me know. 回答1: To make simple and trivial example you could create a class in your class library that will represent

An error occurred while getting provider information from the database

南笙酒味 提交于 2019-12-14 03:41:20
问题 Getting the error: System.Data.ProviderIncompatibleException: An error occurred while getting provider information from the database. This can be caused by Entity Framework using an incorrect connection string. Check the inner exceptions for details and ensure that the connection string is correct. ---> System.Data.ProviderIncompatibleException: The provider did not return a ProviderManifestToken string. ---> System.Data.SqlClient.SqlException: A network-related or instance-specific error

“An attempt to attach an auto-named database for file *FileName* failed.” error after moving from ASP.NET Dev Server to IIS

谁说我不能喝 提交于 2019-12-14 01:18:21
问题 My ASP.NET project has an MDF database in App_Data folder. The connection string is: Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\MainDatabase.mdf;Integrated Security=True;User Instance=True It worked fine until I changed the project parameters to use "Local IIS Web server" instead of "Visual Studio Development Server". The project now produces the following SqlException : An attempt to attach an auto-named database for file C:\Users\Admin\documents\visual studio 2010\Projects\SL

Calling a stored procedure with asp.net

谁说胖子不能爱 提交于 2019-12-14 00:16:19
问题 If I have a connection string defined in my web.config file, how do I create a connection to the SQL db from C# code (sorry forgot to specify) and then call a stored procedure. I would then like to eventually use this data in some way as my DataSource for a GridView. Here is how the connection string is defined in the web.config: <connectionStrings> <add name="db.Name" connectionString="Data Source=db;Initial Catalog=dbCat;User ID=userId;Password=userPass;" providerName="System.Data.SqlClient

Connection String to connect to mysql setup under Ubuntu in Amazon EC2

允我心安 提交于 2019-12-13 20:59:12
问题 Hihi, I have setup an Ubuntu instance in Amazon EC2, and I have setup MySQL under Ubuntu. Would like to ask, how can I connect my external asp.net application to this MySQL database? What should be the connection look like? I am using Entity Framework 4. Thanks in advance! 回答1: Have figured out the connection string format as follow: <add name="ejabberdEntities" connectionString="metadata=res://*/ejabberdDB.csdl|res://*/ejabberdDB.ssdl|res://*/ejabberdDB.msl;provider=MySql.Data.MySqlClient

“Login failed for user ''” when trying to use Windows Authentication

拜拜、爱过 提交于 2019-12-13 15:22:06
问题 On my ASP.NET web.config I have the connection string: initial catalog=DatabaseName; data source=(local); Integrated Security=SSPI;MultipleActiveResultSets=True; Connect Timeout=200; I've used this connection string for Windows Authentication before, but now I'm getting the error: Login failed for user ''. This seems like its a SQL Authentication error, and that the username is blank as I have not supplied either a username or password. Why is the application attempting SQL Authentication and

OleDb Connection not reading all the rows from excel file

二次信任 提交于 2019-12-13 14:32:23
问题 I am using an OleDb in C# connection to read data from an Excel sheet. And fill it in a Datatable. The sheet contains 275 rows and 27 columns. After I read it, Rows 1,2 and 3 are empty. All the other rows are filled correctly. Anyone have an idea on the problem? Here is my code: string connString = "Provider=Microsoft.ACE.OLEDB.12.0;" + "Data Source=" + "C:/Sheets/DataSheet.xls" + ";Extended Properties=Excel 12.0;"; objConn = new OleDbConnection(connString); string Query = "SELECT * FROM

Generate connection string dynamically in ASP.NET MVC

≯℡__Kan透↙ 提交于 2019-12-13 10:36:01
问题 I am calling a stored procedure in a static class and calling that in my controller, which will generate connection string on the fly in my Asp.NET MVC project. I am calling like this: var connection = App.connectionstring.connectionstring.connection().ToString(); Here var connection has the connection string. Now I need to use this connection and connect to database. I followed EntityConnectionStringBuilder() approach like this: var builder = new EntityConnectionStringBuilder(); builder

Retrieving a ConnectionString through System.Configuration Throws Exception

自作多情 提交于 2019-12-13 10:21:34
问题 In my C# application, i am trying to connect to a DataConnection. The application is just a simple Login form but as soon as the user clicks the login button, it throws an exception error referencing the Connection String. Can anyone help? public void userLoginSuccessfull() { try { ////////////////////////////////// // This line is throwing the error ////////////////////////////////// string connString = System.Configuration.ConfigurationManager .ConnectionStrings["connectionString"]