Problema com datas e bases de dados

1 resposta
N

Pessoal preciso de ajuda,

tenho um projecto parado opotrque tenho um erro e não sei o que estou a fazer mal

estou a tentar inserir dados numa base de dados

o código é o seguinte:

cs_insDEPTTSQL.setInt(1,idDEPTtsqlid);
                                cs_insDEPTTSQL.setInt(2,userid);
                                cs_insDEPTTSQL.setInt(3,idm0tiv);
                                cs_insDEPTTSQL.setString(4,txtNDept);
                                cs_insDEPTTSQL.setDate(5,cal_data_alt);
                                cs_insDEPTTSQL.setDate(6,cal_data_alt);
                                cs_insDEPTTSQL.setDate(7,cal_data_alt); 
                                cs_insDEPTTSQL.setString(8,txtODept);                                
                                cs_insDEPTTSQL.registerOutParameter(9,Types.NUMERIC);
                                cs_insDEPTTSQL.registerOutParameter(10,Types.VARCHAR);
                                cs_insDEPTTSQL.registerOutParameter(11,Types.VARCHAR);
                                cs_insDEPTTSQL.registerOutParameter(12,Types.VARCHAR);
                                cs_insDEPTTSQL.registerOutParameter(13,Types.VARCHAR);
                                cs_insDEPTTSQL.registerOutParameter(14,Types.VARCHAR);
mas quando compilo obtenho o seguinte
Compiling 1 source file to N:\Projecto de 5º ano\Project\ESTG_NOPROBLEM\build\generated\classes

N:\Projecto de 5º ano\Project\ESTG_NOPROBLEM\build\generated\src\org\apache\jsp\INSBD_005fDEPARTAMENTO_jsp.java:202: cannot resolve symbol

symbol  : method setDate (int,java.util.Date)

location: interface java.sql.CallableStatement

                                cs_insDEPTTSQL.setDate(5,cal_data_alt);

                                              ^

N:\Projecto de 5º ano\Project\ESTG_NOPROBLEM\build\generated\src\org\apache\jsp\INSBD_005fDEPARTAMENTO_jsp.java:203: cannot resolve symbol

symbol  : method setDate (int,java.util.Date)

location: interface java.sql.CallableStatement

                                cs_insDEPTTSQL.setDate(6,cal_data_alt);

                                              ^

N:\Projecto de 5º ano\Project\ESTG_NOPROBLEM\build\generated\src\org\apache\jsp\INSBD_005fDEPARTAMENTO_jsp.java:204: cannot resolve symbol

symbol  : method setDate (int,java.util.Date)

location: interface java.sql.CallableStatement

                                cs_insDEPTTSQL.setDate(7,cal_data_alt); 

                                              ^

3 errors

N:\Projecto de 5º ano\Project\ESTG_NOPROBLEM\nbproject\build-impl.xml:361: The following error occurred while executing this line:

N:\Projecto de 5º ano\Project\ESTG_NOPROBLEM\nbproject\build-impl.xml:353: The following error occurred while executing this line:

N:\Projecto de 5º ano\Project\ESTG_NOPROBLEM\nbproject\build-impl.xml:141: Compile failed; see the compiler error output for details.

BUILD FAILED (total time: 6 seconds)

alguém pode ajudar-me?

1 Resposta

ramilani12

Vc deu import no seu objeto CallableStatement ou PreparedStatement?

import java.sql.PreparedStatement;
import java.sql.CallableStatement;

Pelo erro ele não encontra o método setDate()…

Criado 27 de fevereiro de 2007
Ultima resposta 27 de fev. de 2007
Respostas 1
Participantes 2