コード例 #1
0
        public void listagridN()
        {
            Conexao Con = new Conexao();
            string  usu = textBoxUsuario.Text;

            if (!Con.Checkconection())
            {
                Con.Conectar();
            }

            if (Con.Checkconection())
            {
                GVUsuario.DataSource = null;
                DataTable        table   = new DataTable();
                MySqlDataAdapter adapter = new MySqlDataAdapter();
                MySqlCommand     command = new MySqlCommand("SELECT * FROM USUARIO", Con.Traz_Conexao());
                adapter.SelectCommand = command;
                adapter.Fill(table);

                GVUsuario.DataSource = table;
                GVUsuario.Update();
                GVUsuario.Refresh();

                Con.Desconectar();
            }
        }
コード例 #2
0
        public void listagridP()
        {
            Conexao Con = new Conexao();
            string  usu = textBoxUsuario.Text;

            if (!Con.Checkconection())
            {
                Con.Conectar();
            }

            if (Con.Checkconection())
            {
                GVUsuario.DataSource = null;
                DataTable        table   = new DataTable();
                MySqlDataAdapter adapter = new MySqlDataAdapter();
                MySqlCommand     command = new MySqlCommand("SELECT * FROM USUARIO WHERE USUARIO = @usuario", Con.Traz_Conexao());
                command.Parameters.Add("@usuario", MySqlDbType.VarChar).Value = (usu);
                adapter.SelectCommand = command;
                adapter.Fill(table);

                GVUsuario.DataSource = table;
                GVUsuario.Update();
                GVUsuario.Refresh();

                Con.Desconectar();
            }
        }