예제 #1
0
        //bd_senha=Responsavel
        public static DataTable bd_senha(String serial, String nome)
        {
            try
            {
                using (SqlConnection conexaoBD = AcessoBD.getinstancia().getconexao())


                    try
                    {
                        if (serial != "")
                        {
                            serial = " CodResponsavel=" + serial;

                            if (nome != "")
                            {
                                nome = " and NomeResponsavel=" + nome;
                            }
                        }
                        else
                        {
                            if (nome != "")
                            {
                                nome = " NomeResponsavel=" + nome;
                            }
                        }
                        conexaoBD.Open();
                        string         ssql          = "select * from Responsavel Where" + serial + nome;
                        SqlCommand     cmdCommand    = new SqlCommand(ssql, conexaoBD);
                        SqlDataAdapter daDataAdapter = new SqlDataAdapter(cmdCommand);
                        DataTable      dtDatatable   = new DataTable();
                        daDataAdapter.Fill(dtDatatable);
                        return(dtDatatable);
                    }
                    catch (SqlException bdex)
                    {
                        throw bdex;
                    }
                finally
                {
                    conexaoBD.Close();
                }
            }
            catch {
                using (SqlConnection conexaoBD = AcessoBD.getinstancia().getconexaosa())


                    try
                    {
                        if (serial != "")
                        {
                            serial = " CodResponsavel=" + serial;

                            if (nome != "")
                            {
                                nome = " and NomeResponsavel=" + nome;
                            }
                        }
                        else
                        {
                            if (nome != "")
                            {
                                nome = " NomeResponsavel=" + nome;
                            }
                        }
                        conexaoBD.Open();
                        string         ssql          = "select * from Responsavel Where" + serial + nome;
                        SqlCommand     cmdCommand    = new SqlCommand(ssql, conexaoBD);
                        SqlDataAdapter daDataAdapter = new SqlDataAdapter(cmdCommand);
                        DataTable      dtDatatable   = new DataTable();
                        daDataAdapter.Fill(dtDatatable);
                        return(dtDatatable);
                    }
                    catch (SqlException bdex)
                    {
                        throw bdex;
                    }
                finally
                {
                    conexaoBD.Close();
                }
            }
        }
예제 #2
0
 private void button1_Click(object sender, EventArgs e)
 {
     AcessoBD.setsenhasa(textBox2.Text);
 }
예제 #3
0
 private void button1_Click(object sender, EventArgs e)
 {
     dataGridView1.DataSource = AcessoBD.BD_juridico(textBox1.Text, textBox2.Text, textBox3.Text);
 }