1
Aguem could help me I’m doing a project to deliver this year in college in 4 layers I have a login screen and when I type user and password I choose the company I should work example Company A, Company B, Company c, in sql server I have 3 bdEmpresaA banks, bdEmpresaB, bdEmpresaC, when selecting the company wanted to connect to the corresponding bank more I have no idea how to do this follows the screens below
Tela Login
String Connection screen
Business register
my bank
SqlConnection CON = new SqlConnection(); //Faz a conexão com o Banco de Dados
CON.ConnectionString = Properties.Settings.Default.csSistemaEstoque; // Cria uma string de conexão
SqlCommand CM = new SqlCommand(); //
CM.CommandType = System.Data.CommandType.Text;
CON.Open();
CM.CommandText = "INSERT INTO tbEmpresaUsuaria ([dtInclusao_emp], [razao_emp], [nomeFant_emp], [cnpj_emp], [inscEst_emp], [logradouro_emp], [endereco_emp], " +
" [numero_emp], [compl_emp], [bairro_emp], [cidade_emp], [uf_emp], [cep_emp], [tel_emp], [tel2_emp], [email_emp], [site_emp], [endLogo_emp])" +
" VALUES (@dtInclusao_emp, @razao_emp, @nomeFant_emp, @cnpj_emp, @inscEst_emp, @logradouro_emp, @endereco_emp, @numero_emp, " +
" @compl_emp, @bairro_emp, @cidade_emp, @uf_emp, @cep_emp, @tel_emp, @tel2_emp, @email_emp, @site_emp, @endLogo_emp)";
If anyone can help me, I’d appreciate it
login screen code
private void cbbEmpresaUsuaria_SelectedIndexChanged(object sender, EventArgs e)
{
string myConnString = String.Empty;
codEmpUsuaria = Convert.ToString(cbbEmpresaUsuaria.SelectedValue);// pego o codigo empresa usuaria selecionado no ComboBox
var empresa = codEmpUsuaria;
if (empresa.Equals("1"))
{
myConnString = "Data Source=servidor;Initial Catalog=empresaA;User ID=teste;Password=123456";
} if (empresa.Equals("2"))
{
myConnString = "Data Source=servidor;Initial Catalog=empresaB;User ID=teste;Password=123456";
}
}
<connectionStrings>
<add name="Data Source=servidor;Initial Catalog=dbSistEstoqueEmp;User ID=teste;Password=123456"
providerName="System.Data.SqlClient" />
Show the selection code and how you would do for a company.
– Maniero
I don’t understand your question
– Denilson Carlos