View Single Post
  #1 (permalink)  
Old 04-29-2008, 07:48 PM
lemurian lemurian is offline
Member
 
Join Date: Apr 2008
Posts: 1
lemurian is on a distinguished road
Help with Java and MS access
I have the next problem. I want to make a little translation program, I have in access a table that has two columns Espaņol and Frances.
I'm using a JtextBox to introduce a spanish word, for example ROJO, and I want to retrieve the french word rouge.
The query sentence shows me the last word in Frances. I have the following structure:

Espaņol Frances
rojo rouge
negro noir

and this is the code
try
{
String ruta = "C:\\dicc.mdb";
String referencia = "jdbcdbc:MS Access Database;DBQ="+ruta;

//Levantar controlador o carga el controlador
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conecta = DriverManager.getConnection(referencia);
Statement s = conecta.createStatement();
ResultSet rs = s.executeQuery("SELECT Espaņol, Frances FROM espfran =");

while(rs.next())
{
res=rs.getString("Frances");
}
jLabel.setText(res);
conecta.close();
}
catch(Exception jl)
{
JOptionPane.showMessageDialog(null,jl.getMessage() );
}

Hope someone can help me. please email me @ lemurianredmage@hotmail.com
Reply With Quote
Sponsored Links