connection-string

VB.NET Connection string (Web.Config, App.Config)

佐手、 提交于 2019-11-28 07:35:15
问题 Really having an annoying time with connection strings. I have two projects together in a single solution. A Web forms application acting as the presentation layer, and a class library supporting it which will send and receive data from a database. -- The Employee Class within the Class Library Project -- Friend Class Employee Public Function GetEmployees() As DataSet Dim DBConnection As New SqlConnection(My_ConnectionString) Dim MyAdapter As New SqlDataAdapter("exec getEmployees",

SQL Azure EF Database First Connection String in Azure Management Portal

谁说胖子不能爱 提交于 2019-11-28 07:30:44
问题 I have a site running n Azure, which uses EF Database First model. If I embed the connection string in the web.config and deploy all is rosy. <add name="MyEntities" connectionString="metadata=res://*/App_Code.Model.csdl|res://*/App_Code.Model.ssdl|res://*/App_Code.Model.msl;provider=System.Data.SqlClient;provider connection string='Data Source=my.database.windows.net;Initial Catalog=myTest_DB;User ID=***;Password=***; MultipleActiveResultSets=False'" providerName="System.Data.EntityClient"/>

Entity Framework with Microsoft Access

老子叫甜甜 提交于 2019-11-28 07:24:10
问题 I use .accdb file. I created class using System.Data.Entity; class MSADbContext:DbContext { public DbSet<Product> Products { get; set; } } and add connectionString <add name="MSADbContext" connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\SportsStore.accdb" providerName="System.Data.OleDb"/> After first query to DB I get the ProviderIncompatibleException: "calling "get_ProviderFactory" in repository typeOf "System.Data.OleDb.OleDbConnection" returns null" 回答1: Your connection

SQL Server: Modifying the “Application Name” property for auditing purposes

ε祈祈猫儿з 提交于 2019-11-28 07:00:29
As we do not implement the users of our applications as users in SQL server, when the application server connects to a database each application always uses the same credentials to attach to each database. This presents an auditing problem. Using triggers, we want to store every update, insert and delete and attribute each to a particular user. One possible solution is to add an "updated by user" column to every table and update this every time. This means a new column on every table and a new parameter on every stored procedure. It also means you can only do soft deletes. Instead of this I

How to get database url from java.sql.Connection?

耗尽温柔 提交于 2019-11-28 06:08:51
For given Connection instance how do I find out url that the Connection uses to connect the database ? Is it somewhere in Properties returned by Connection.getClientInfo() method? If there you need me to provide clearer description all comments are welcome. Thank you Connection has the getMetaData() to return DatabaseMetaData . DatabaseMetaData has the getURL() to return the URL for this DBMS. Lucas de Oliveira I believe you can use the DatabaseMetaData object from the Connection and then get the URL. Try: DatabaseMetaData dmd = connection.getMetaData(); String url = dmd.getURL(); Mehdi Inside

Connect to SQL Server Database from PowerShell

*爱你&永不变心* 提交于 2019-11-28 05:47:54
I have looked around online for a while now and found many similar problems but for some reason I can't seem to get this working. I am just trying to connect to a SQL server database and output the query results to a file - See PowerShell script below. What I am uncertain about is how to integrate the User ID and Password into the connection string. $SQLServer = "aaaa.database.windows.net" $SQLDBName = "Database" $uid ="john" $pwd = "pwd123" $SqlQuery = "SELECT * from table;" $SqlConnection = New-Object System.Data.SqlClient.SqlConnection $SqlConnection.ConnectionString = "Server = $SQLServer;

Ado connection to SQL Server Compact Edition 4.0

血红的双手。 提交于 2019-11-28 05:30:22
问题 I want to connect to SQL Server Compact Edition 4.0 from an old asp-classic site but i always get the error: "Microsoft OLE DB Provider for ODBC Drivers error '80004005' [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified. " I tried sCon = "Data Source=c:\temp\sqlcompact.sdf;Encrypt Database=True;Password=testtest;Persist Security Info=False;" and Update: Error: Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if

Display a ConnectionString dialog

橙三吉。 提交于 2019-11-28 05:26:48
I'm trying to create a program in C# that should be able to create, backup and restore a SQL Server database. For this, the user needs to be able to setup a connection string to the desired SQL Server (and database). I would like to use the same dialog as for example Visual Studio for creating the connection string. Is this possible? Damith Note: The dialog component referred to below is no longer available for download. Unless you have retrieved it in the past, you will probably not get this answer's sample code to work. Alternative: There is now a different DataConnectionDialog available on

pyodbc can't connect to database

别等时光非礼了梦想. 提交于 2019-11-28 05:21:12
问题 I'm using pyodbc library from here and I'm connecting this way: conn = pyodbc.connect(r'DRIVER={SQL Server Native Client 11.0};Server=(localdb)\MSSQLLocalDB;Integrated Security=true; database = online_banking; autocommit = True') I use MSSQLLocalDB because it's the default instance name for SQL Server 2014. And this last version of Python 2.7. However I cant run any simple query, every if them raise the error, saying that there is no such object or in that particular case database: cursor

Dynamically change connectionString in web.config

匆匆过客 提交于 2019-11-28 05:20:47
问题 I have the following in my web.config <connectionStrings> <add name="ActiveDirectoryConnection" connectionString="LDAP://ActiveDirectoryDomain1.com" providerName="System.Web.Security.ActiveDirectoryMembershipProvider"/> </connectionStrings> I need to add a dropdown box to my login page that allows the user to change the connectionString to a different string, e.g. "LDAP://ActiveDirectoryDomain2.com" In C# code behind how do change the connectionString value? More info: The problem I am having