connection-string

Connection String Is not Working Object instance reference is null

こ雲淡風輕ζ 提交于 2019-12-26 12:39:07
问题 //'Object reference not set to an instance of an object.' Please Do not mark it as redundant question . I have tried almost all the methods to make a connection string first one is by : string connectionString = ConfigurationManager.ConnectionStrings["ClinicalConnectionString"].ConnectionString; the second one : string connectionstringgg = Properties.Settings.Default.ClinicalConnectionString; third method is by : ConnectionStringSettings connectionSetting = ConfigurationManager

VB.net ConnectionStrings object reference

拟墨画扇 提交于 2019-12-25 18:53:45
问题 when connecting i get an error: object reference not set to instance of an object Form1 Dim c As String = System.Configuration.ConfigurationManager.ConnectionStrings("CON").ConnectionString Dim con As New MySqlConnection(c) App.config <?xml version="1.0" encoding="utf-8" ?> <configuration> <connectionStrings> <add name="CON" providerName="MySql.Data.MySqlClient" connectionString="Server=localhost;Database=DATABASE_;Uid=user;Pwd=pass" /> </connectionStrings> </configuration> I have no idea how

ADODB Connection.ConnectionString property doesn't return server name

China☆狼群 提交于 2019-12-25 18:24:17
问题 I am using ActiveX Data Objects 6.1 library in Excel VBA to access a SQL Server 2012 database. I can connect and run queries fine, but once connected there appears to be no way to determine which server the connection object is connected to, as the connectionString property does not return the same string that was used to open the connection: Public Sub connectDB() Dim conn As New Connection Dim strServer As String, strDatabase As String, strUser As String, strPassword As String strServer = "

ADODB Connection.ConnectionString property doesn't return server name

北慕城南 提交于 2019-12-25 18:23:03
问题 I am using ActiveX Data Objects 6.1 library in Excel VBA to access a SQL Server 2012 database. I can connect and run queries fine, but once connected there appears to be no way to determine which server the connection object is connected to, as the connectionString property does not return the same string that was used to open the connection: Public Sub connectDB() Dim conn As New Connection Dim strServer As String, strDatabase As String, strUser As String, strPassword As String strServer = "

I cannot retrieve connection string in DbContext class in .NET Core 2.2 Razor Pages

好久不见. 提交于 2019-12-25 17:20:36
问题 In Startup.cs Configure Services this works: var connection = Configuration["ConnectionStrings:DefaultConnection"]; services.AddDbContext<MyDbContext>( options => { options.UseSqlServer(connection); }); In my MyDbContext.cs class this doesn't work: using System; using System.Collections.Generic; using System.Threading.Tasks; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; using OESAC.Models; namespace OESAC.Models { public class MyDbContext : DbContext { public

How to connect to SQL Server with Windows authentication from Node.JS using knex module

北战南征 提交于 2019-12-25 17:16:15
问题 I am trying to connect SQL Server using knex with Windows Authentication from my node.js application. Config: { client: 'mssql', connection: { database: 'MyDBName', host: 'xx.xx.xx.xxx', server: 'MY-SERVER_NAME\\SQLEXPRESS', options: { encrypt: false, trustedConnection: true, }, }, } I didn't add username and password in the config as I have added trustedConnection: true for Windows Authentication . But I am getting the following error: Login failed for user ''. Even if I add add username and

Accessing Web.Config from a separate solution

半城伤御伤魂 提交于 2019-12-25 12:35:09
问题 I have two solutions, one is a class library and the other is a web application, and I want to get the connection string from the web.config file to the class library as I am developing a custom membership provider. I am using Framework 4.0 and MS Visual Studio 2010. Thanks 回答1: You can put the configuration settings for any library in the main web.config. It's easy! Connection strings are especially easy. Just add your connection string to the connectionstrings section with the same name it

read,write and update connectionstring in app.config file at run time in C#

﹥>﹥吖頭↗ 提交于 2019-12-25 10:55:08
问题 I have created a form for connection settings, where user can update server name, datatbase and user id and password. I have stored my connection string in app.config file. My problem is, how can I update connection string in app.config file at run time and How can I change the information of the conectionstring through the text box on the form in the first time, the text box will display information of server name, id, password after the first time here my app.config <?xml version="1.0"

How to run wpf(c#) application by service account and integrated security

守給你的承諾、 提交于 2019-12-25 10:53:47
问题 i want to run my WPF aplication with service account... Maybe i dont understain situation currectlly but i want to use integrated security=true; in my connectionString and run application localy but with different account. Is that even possible? Lets say my windows login acc is testAcc and my service account is SAtestAcc . SAtestAcc has execute rights on database1 and testAcc doesnt have any on same database1... So how do i specify in my connectionString that i am trying to connect to

How to secure my connection string? powershell + xml

╄→гoц情女王★ 提交于 2019-12-25 09:39:17
问题 I store my connection-string in XML file. Then i use it in powershell script. Is there a way to secure it/to encrypt it somehow? 回答1: There are two methods I've seen for encrypting in Powershell Use *SecureString cmdlets. It should be noted only the Windows ID that encrypted the original string can decrypt it (since it uses the Windows login as key) Use a pass phrase with the Library-StringCrypto functions Because of the limitations of the first method, I use the second. I'll then store my