Hi everyone,
I had installed in my computer Visual Studio 2008 Trial when I try use the class ConfigurationManager to change in run time my stringconnection seems that class don't exists.
What I must do?
Best Regards,
Renan Paiva
msn: [email protected]
renan paivaPosted Apr 26, 2008, 8:51 PM
So sorry I'm brazilam and my English is so poor, I add reference and then appear the class ConfigurationManager to me thank you so much.
renan paivaPosted Apr 26, 2008, 8:41 PM
First thanks for your reply follow there is my font
using
System;using
System.Collections.Generic;using
System.ComponentModel;using
System.Data;using
System.Data.SqlClient;using
System.Drawing;using
System.Linq;using
System.Text;using
System.Windows.Forms;using
System.Configuration;namespace
Pipe_Analyst_Control{
public partial class Conexao : Form{
public Conexao(){
InitializeComponent();
}
private void Cancelbutton_Click(object sender, EventArgs e){
this.Dispose();}
private void Savebutton_Click(object sender, EventArgs e){
SqlConnectionStringBuilder bilder = new SqlConnectionStringBuilder();bilder.DataSource = ServidortextBox.Text.Trim();
bilder.InitialCatalog =
"pipedata";bilder.IntegratedSecurity =
true;bilder.UserID = UsertextBox.Text.Trim();
bilder.Password = SenhatextBox.Text.Trim();
ConfigurationSettings.AppSettings.Set("pipedataConnectionString", bilder.ConnectionString);//here I must use ConfigurationManager but it is unviable.
}
private void Testbutton_Click(object sender, EventArgs e)
{
SqlConnection SqlCon = new SqlConnection(Pipe_Analyst_Control.Properties.Settings.Default.pipedataConnectionString);
try
{
SqlCon.Open();
MessageBox.Show("ConexÆo configurada com sucesso", "Sucesso", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);}
catch{
MessageBox.Show("A conexÆo falhou por favor configure novamente ou tente salvar as configura‡äes vigentes", "ERRO", MessageBoxButtons.OK, MessageBoxIcon.Error);}
}
}
}
Posted Apr 26, 2008, 1:43 PM