Click here to Skip to main content
15,885,186 members
Home / Discussions / C#
   

C#

 
GeneralRe: Looking to hire a programmer Pin
Thomas Matson10-Mar-23 11:57
Thomas Matson10-Mar-23 11:57 
AnswerRe: Looking to hire a programmer Pin
Gerry Schmitz13-Mar-23 7:32
mveGerry Schmitz13-Mar-23 7:32 
QuestionLooking for programmers for 8Bit Music Studio in C# (.Net) Pin
kiri0086-Mar-23 21:56
kiri0086-Mar-23 21:56 
AnswerRe: Looking for programmers for 8Bit Music Studio in C# (.Net) Pin
Richard MacCutchan6-Mar-23 22:10
mveRichard MacCutchan6-Mar-23 22:10 
AnswerRe: Looking for programmers for 8Bit Music Studio in C# (.Net) Pin
OriginalGriff6-Mar-23 22:25
mveOriginalGriff6-Mar-23 22:25 
AnswerRe: Looking for programmers for 8Bit Music Studio in C# (.Net) Pin
Gerry Schmitz7-Mar-23 6:03
mveGerry Schmitz7-Mar-23 6:03 
AnswerRe: Looking for programmers for 8Bit Music Studio in C# (.Net) Pin
jschell8-Mar-23 6:54
jschell8-Mar-23 6:54 
QuestionC# config file stopped working Pin
Ismael_19991-Mar-23 3:11
Ismael_19991-Mar-23 3:11 
Hi, everyone.

I´ve developped a C# program and I have a problem with configuration file.
I use Visual Studio 2022 and Windows 10.
To start, the program acesses the configuration file to read some information, then, after the user enters username and password the program grants (or not) use and opens main screen.
In config file there are information about server name and DB name. Everything worked fine until some days ago. I made some changes in config file (I removed a variable) and, in my computer it works, but in another computer it does't anymore.An exception appears about connection to DB which is closed. After many prints I foud out that the program is using variables not from the config file, and I don1t know where it comes from. I have also another program which deals with this config file. This file also can't access config file correctly.
Here is a snippet of the code of this second file:


ExeConfigurationFileMap fileMap = new ExeConfigurationFileMap();
fileMap.ExeConfigFilename = Base.caminho + Base.nomeArquivo + ".exe.config";
Configuration config = ConfigurationManager.OpenMappedExeConfiguration(fileMap, ConfigurationUserLevel.None);
string Banco = config.AppSettings.Settings["Tipo"].Value;
string Servidor = config.AppSettings.Settings["Servidor"].Value;
string Empresa = config.AppSettings.Settings["Empresa"].Value;
string Local = config.AppSettings.Settings["Local"].Value;
string Diretorio = config.AppSettings.Settings["Pasta"].Value;
MessageBox.Show("Arquivo de configuração = " + fileMap.ExeConfigFilename + "\nServidor = " + Servidor + "   Empresa = " + Empresa + "   Local = " + Local +
           "\nDiretório = " + Diretorio + "   Banco = " + Banco);
if (!VerificaBasedeDados(Banco))
{
    MessageBox.Show("Base de dados  " + Banco + "  inexistente!");
    return;
}


In the first MessageBox.Show, the variable Banco (which is the DB name) is different from what is in the config file!
The 'if' after tests if the DB exists, but the program crashes before it.
The curious thing here is that in my computer it runs OK. In other computers it doesn't (I tried in 2). And before that change it ran OK too!
I tried to include back the variable but it didn't work.
Does anyone have any ideas?
Thanks.
AnswerRe: C# config file stopped working Pin
Richard Deeming1-Mar-23 3:25
mveRichard Deeming1-Mar-23 3:25 
GeneralRe: C# config file stopped working Pin
Ismael_19992-Mar-23 10:01
Ismael_19992-Mar-23 10:01 
GeneralRe: C# config file stopped working Pin
Richard Deeming2-Mar-23 21:21
mveRichard Deeming2-Mar-23 21:21 
GeneralRe: C# config file stopped working Pin
Eddy Vluggen4-Mar-23 8:03
professionalEddy Vluggen4-Mar-23 8:03 
QuestionNuget Visual Studio Pin
Kevin Dzimiera 202226-Feb-23 11:48
Kevin Dzimiera 202226-Feb-23 11:48 
AnswerRe: Nuget Visual Studio Pin
Dave Kreskowiak26-Feb-23 15:20
mveDave Kreskowiak26-Feb-23 15:20 
AnswerRe: Nuget Visual Studio Pin
Eddy Vluggen4-Mar-23 8:07
professionalEddy Vluggen4-Mar-23 8:07 
QuestionDeleting characters from a list<char> Pin
mjcs10024-Feb-23 5:53
mjcs10024-Feb-23 5:53 
AnswerRe: Deleting characters from a list<char> Pin
Gerry Schmitz24-Feb-23 8:53
mveGerry Schmitz24-Feb-23 8:53 
GeneralRe: Deleting characters from a list<char> Pin
mjcs10024-Feb-23 11:18
mjcs10024-Feb-23 11:18 
GeneralRe: Deleting characters from a list<char> Pin
Gerry Schmitz24-Feb-23 19:25
mveGerry Schmitz24-Feb-23 19:25 
GeneralRe: Deleting characters from a list<char> Pin
mjcs10024-Feb-23 20:35
mjcs10024-Feb-23 20:35 
GeneralRe: Deleting characters from a list<char> Pin
Gerry Schmitz25-Feb-23 6:39
mveGerry Schmitz25-Feb-23 6:39 
AnswerRe: Deleting characters from a list<char> Pin
Eddy Vluggen25-Feb-23 6:24
professionalEddy Vluggen25-Feb-23 6:24 
AnswerRe: Deleting characters from a list<char> Pin
lmoelleb27-Feb-23 4:45
lmoelleb27-Feb-23 4:45 
AnswerRe: Deleting characters from a list<char> Pin
jochance7-Mar-23 8:21
jochance7-Mar-23 8:21 
QuestionC# xml serialization Pin
di24125313416-Feb-23 2:02
di24125313416-Feb-23 2:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.