good is my first question here: I have doubts on how to make a query within a randomaccessfile. I have this part of the code the only thing that it does is that if I write the name of my first product that is in the list if it prints it, but if I look for another name that is later that tells me that the "product is not found registered "even if it is.
public void Consulta()
{
try
{
Prod=new RandomAccessFile(Catalogo.dat,rw);
String Pro,busc;
int Encontrado=0;
busc=JOptionPane.showInputDialog(ingressa el nombre del producto);
while((Pro=Prod.readLine())!=null)
{
if(Pro.equalsIgnoreCase(busc))
{
Familia=Prod.readLine();
Marca=Prod.readLine();
Bod=Prod.readLine();
Precio=Prod.readFloat();
System.out.println(nombre+Pro+n
+ Familia+Familia+n
+ Marca+Marca+n
+ Bodega+Bod+n
+ Precio$+Precio+n);
Encontrado++;
}
}
if(Encontrado==0)
{
JOptionPane.showMessageDialog(null, el Producto no esta registrado);
}
Prod.close();
}
catch(FileNotFoundException e)
{
}
catch(IOException e)
{
}
}