CodePudding user response:
Using adonet and can obtain a database connection, so he is not a database or database connection string problem, should be the problem of appconfig, by the way, using CYQ framework
CodePudding user response:
In the current project of the App. The Config search search connSql first
CodePudding user response:
# 2 is the solution, not now
CodePudding user response:
My app. Config file only a configuration item, the name is called "connSql"
CodePudding user response:
reference 4 floor weixin_45933985 response: my app. The config file is only one configuration items, the name is called connSql The overall look at the config CodePudding user response:
Isn't it similar to the following structure, basic is the Config file & lt; ConnectionStrings> CodePudding user response:
<? The XML version="1.0" encoding="utf-8"?> CodePudding user response:
refer to fifth floor by_ love reply: Quote: refer to 4th floor weixin_45933985 response: My app. Config file only a configuration item, the name is called connSql Overall the config to see Well, from here CodePudding user response:
1. You have to make sure your solution is more engineering 2. The current startup project which is 3. The project of appConfig connSql this thing CodePudding user response:
references to the tenth floor OrdinaryCoder response: 1. You have to make sure that your solution is engineering 2. The current startup project which is 3. The project of appConfig have connSql this thing Well, I have two projects, I set this to start the project, its appconfig really have ConnSql the configuration items,, CodePudding user response:
11 references weixin_45933985 response: Quote: reference to the tenth floor OrdinaryCoder response: 1. You have to make sure your solution is more engineering 2. The current startup project which is 3. The project of appConfig have connSql this thing Well, I have two projects, I set this to start the project, its appconfig really have ConnSql the configuration items,, I remember reading the configuration file will be read the current startup but also may remember the wrong try another project also add this in your configuration file CodePudding user response:
The project structure and App. Config screenshots? CodePudding user response:
refer to 12 floor OrdinaryCoder reply: Quote: reference 11 floor weixin_45933985 response: The Quote: reference to the tenth floor OrdinaryCoder response: 1. You have to make sure your solution is more engineering 2. The current startup project which is 3. The project of appConfig have connSql this thing Well, I have two projects, I set this to start the project, its appconfig really have ConnSql the configuration items,, I remember reading the configuration file will be read the current startup but also may remember try another project in the configuration file is also combined with the Another project is webform, webconfig the appconfig code inside the same with me, to access the same database CodePudding user response:
reference 13 floor csdnFUCKINGSUCKS reply: project structure and App config screenshot? The config file code posted on the above, just a connectionstrings CodePudding user response:
To try it, I use your config, nothing wrong with string conn=ConfigurationManager. ConnectionStrings [r]. "connSql" ConnectionString; CodePudding user response:
So, you open a new project alone, even the config, after the success, then, you carefully check under the original project, where is the missing & lt; ? The XML version="1.0" encoding="utf-8"?> using System; using System.Collections.Generic; Using System.Com ponentModel; using System.Data; Using System. Drawing; using System.Linq; using System.Text; Using System. Windows. Forms; Using System. The Configuration; The namespace WindowsFormsApp3 { Public partial class Form1: Form { Public _click () { InitializeComponent (); } Private void button1_Click (object sender, EventArgs e) { String conn=ConfigurationManager. ConnectionStrings [r]. "connSql" ConnectionString. ToString (); } } } CodePudding user response:
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull