public void PegarFornecedor() { DataSet ds = new DataSet(); try { this.conn = new NpgsqlConnection(this.connString); //Abra a conexão com o PgSQL this.conn.Open(); string buscar = String.Format("Select id, cnpj, nome, nome_usuario, endereco, telefone, email, senha from usuario where id = {0}", AutenticacaoCliente.pegarId()); using (NpgsqlCommand pgsqlcommand = new NpgsqlCommand(buscar, this.conn)) { //pgsqlcommand.Fill(dt); NpgsqlDataReader dr = pgsqlcommand.ExecuteReader(); if (dr.HasRows) { if (dr.Read()) { AutenticacaoCliente.Fornecedor(dr.GetInt32(0), dr.GetInt64(1).ToString(), dr.GetString(2), dr.GetString(3), dr.GetString(4), dr.GetString(5), dr.GetString(6), dr.GetString(7)); } } else { Console.WriteLine("Não funcionou!"); } } } catch (NpgsqlException ex) { throw ex; //return dt.ToString(); } catch (Exception ex) { throw ex; //return dt.ToString(); } finally { this.conn.Close(); } }