private void consultasToolStripMenuItem_Click(object sender, EventArgs e) { this.Visible = false; CadastroMoto Form2 = new CadastroMoto(); Consultas newForm3 = new Consultas(); newForm3.ShowDialog(); }
private void consultasToolStripMenuItem_Click(object sender, EventArgs e) { this.Visible = false; Ocorrencias Form2 = new Ocorrencias(); Consultas newForm3 = new Consultas(); newForm3.ShowDialog(); }
public void logar() { sqlConn = new SqlConnection(strConn); string usuario, senha; try { usuario = textBox1.Text; senha = textBox2.Text; _Sql = "SELECT COUNT (usuario) FROM tbADM WHERE usuario = @usuario AND senha = @senha "; SqlCommand comando = new SqlCommand(_Sql, sqlConn); comando.Parameters.Add("@usuario", SqlDbType.VarChar).Value = usuario; comando.Parameters.Add("@senha", SqlDbType.VarChar).Value = senha; sqlConn.Open(); int v = (int)comando.ExecuteScalar(); if (v > 0) { this.Visible = false; Consultas Form2 = new Consultas(); Consultas newForm3 = new Consultas(); newForm3.ShowDialog(); } else { MessageBox.Show("Usuario ou senha incorretos"); } } catch (SqlException erro) { MessageBox.Show(erro + "No banco"); } }