Green29 de Septiembre del 2005
Preguntaesto es parte de mi codigo, en el cual hay casillas detexto y combos, pero no puedo lograr guardar los datos selecionados x el usuario en la base
<%
Connection canal = null;
ResultSet tabla= null;
Statement instruccion=null;
String strcon = "jdbc:mysql://localhost/proyectos?user=admon&password=admon";
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
canal=DriverManager.getConnection(strcon);
instruccion = canal.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
} catch(java.lang.ClassNotFoundException e){};
%>
<h2 align="center"><strong>DATOS DEL PROYECTO</strong></h2>
<p align="center"> </p>
<form name="form1" method="post" action="">
<strong>Proyecto</strong>
<input type="text" name="textfield">
</form>
<form name="form2" method="post" action="">
<strong>Institución</strong>
<input name="textfield3" type="text" value="Instituto Tecnologico de Villahermosa" size="20">
</form>
<form name="form3" method="post" action="">
<strong>Clave</strong>
<%
String SQLStatementLISTA_2 = "SELECT * FROM proyectos.proyecto ORDER BY IdProyecto";
Statement StatementLISTA_2 = canal.createStatement();
ResultSet RecordsetLISTA_2 = StatementLISTA_2.executeQuery(SQLStatementLISTA_2);
System.out.println(" ExecuteQuery RecordSetLISTA_2");
%>
<select name="form3" class="" id="form3" tabindex="1">
<% while(RecordsetLISTA_2.next())
{%>
<option value="<%=((RecordsetLISTA_2.getObject("IdProyecto")!=null)?RecordsetLISTA_2.getObject("IdProyecto"):"")%>"> <%=((RecordsetLISTA_2.getObject("Clave")!=null)?RecordsetLISTA_2.getObject("Clave"):"")%></option><%}%>
</select>
</form>
<form name="form4" method="post" action="">
<strong>Departamento</strong>
<%
String SQLStatementLISTA_3 = "SELECT * FROM itvh.adscripciones ORDER BY IdAdscripcion";
Statement StatementLISTA_3 = canal.createStatement();
ResultSet RecordsetLISTA_3 = StatementLISTA_3.executeQuery(SQLStatementLISTA_3);
System.out.println(" ExecuteQuery RecordSetLISTA_3");
%>
<select name="form4" class="" id="form4" tabindex="1">
<% while(RecordsetLISTA_3.next())
codigo para guardar en la base:
String Nombre = request.getParameter("Proyecto");
String Institucion = request.getParameter("Institución");
String Clave = request.getParameter("Clave");
int IdAdscripcion = Integer.parseInt(request.getParameter("Departamento"));
int IdAdscripResponsable = Integer.parseInt(request.getParameter("Responsable del Departamento"));
int IdJefeProyecto = Integer.parseInt(request.getParameter("Jefe de Proyecto"));
String EquipoApoyo = request.getParameter("Equipo de Apoyo");
int IdCliente = Integer.parseInt(request.getParameter("Cliente"));
int IdAdscripCliente = Integer.parseInt(request.getParameter("Departamento"));
//date FechaInicio =Date.parseDate(request.getParameter("Fecha Inicio"));
//date FechaTerminacion =Date.parseDate(request.getParameter("Fecha Terminacion"));
int IdResponsablePrueba = Integer.parseInt(request.getParameter("Responsable de Prueba"));
//date FechaPrueba =Date.parseDate(request.getParameter("Fecha de Prueba"));
int IdResponsableAprobacion = Integer.parseInt(request.getParameter("Responsable de Aprobacion"));
int IdResponsableLiberacion = Integer.parseInt(request.getParameter("Responsable de Liberacion"));
//date FechaLiberacion =Date.parseDate(request.getParameter("Fecha de Liberacion"));
int IdResponsableEvaluacion = Integer.parseInt(request.getParameter("Responsable de Evaluacion"));
String PeriodoEvaluacion = request.getParameter("Periodo de Evaluacion");
String Observaciones = request.getParameter("Observaciones");
String Tipo = request.getParameter("Tipo");
// insert into tabla() values();
String q="insert into proyecto(Nombre,Institucion,Clave,IdAdscripcion,IdAdscripResponsable,IdJefeProyecto,EquipoApoyo,IdCliente,IdAdscripCliente,IdResponsablePrueba,IdResponsableAprobacion,IdResponsableLiberacion,IdResponsableEvaluacion,PeriodoEvaluacion,Observaciones,Tipo)
values("" +Nombre+"","+Institución+","+Clave+","+IdAdscripcion+","+IdAdscripResponsable+","+IdJefeProyecto+","+Equipo de Apoyo+","+IdCliente+","+IdAdscripCliente+","+FechaInicio+","+FechaTerminacion+","+ResponsablePrueba+","+FechaPrueba+","+ResponsableAprobacion+","+ResponsableLiberacion+","+FechaLiberacion+","+IdResponsableEvaluacion+","+Periodo de Evaluacion+","+Observaciones+","+Tipo+"); ";
<%
Connection canal = null;
ResultSet tabla= null;
Statement instruccion=null;
String strcon = "jdbc:mysql://localhost/proyectos?user=admon&password=admon";
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
canal=DriverManager.getConnection(strcon);
instruccion = canal.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
} catch(java.lang.ClassNotFoundException e){};
%>
<h2 align="center"><strong>DATOS DEL PROYECTO</strong></h2>
<p align="center"> </p>
<form name="form1" method="post" action="">
<strong>Proyecto</strong>
<input type="text" name="textfield">
</form>
<form name="form2" method="post" action="">
<strong>Institución</strong>
<input name="textfield3" type="text" value="Instituto Tecnologico de Villahermosa" size="20">
</form>
<form name="form3" method="post" action="">
<strong>Clave</strong>
<%
String SQLStatementLISTA_2 = "SELECT * FROM proyectos.proyecto ORDER BY IdProyecto";
Statement StatementLISTA_2 = canal.createStatement();
ResultSet RecordsetLISTA_2 = StatementLISTA_2.executeQuery(SQLStatementLISTA_2);
System.out.println(" ExecuteQuery RecordSetLISTA_2");
%>
<select name="form3" class="" id="form3" tabindex="1">
<% while(RecordsetLISTA_2.next())
{%>
<option value="<%=((RecordsetLISTA_2.getObject("IdProyecto")!=null)?RecordsetLISTA_2.getObject("IdProyecto"):"")%>"> <%=((RecordsetLISTA_2.getObject("Clave")!=null)?RecordsetLISTA_2.getObject("Clave"):"")%></option><%}%>
</select>
</form>
<form name="form4" method="post" action="">
<strong>Departamento</strong>
<%
String SQLStatementLISTA_3 = "SELECT * FROM itvh.adscripciones ORDER BY IdAdscripcion";
Statement StatementLISTA_3 = canal.createStatement();
ResultSet RecordsetLISTA_3 = StatementLISTA_3.executeQuery(SQLStatementLISTA_3);
System.out.println(" ExecuteQuery RecordSetLISTA_3");
%>
<select name="form4" class="" id="form4" tabindex="1">
<% while(RecordsetLISTA_3.next())
codigo para guardar en la base:
String Nombre = request.getParameter("Proyecto");
String Institucion = request.getParameter("Institución");
String Clave = request.getParameter("Clave");
int IdAdscripcion = Integer.parseInt(request.getParameter("Departamento"));
int IdAdscripResponsable = Integer.parseInt(request.getParameter("Responsable del Departamento"));
int IdJefeProyecto = Integer.parseInt(request.getParameter("Jefe de Proyecto"));
String EquipoApoyo = request.getParameter("Equipo de Apoyo");
int IdCliente = Integer.parseInt(request.getParameter("Cliente"));
int IdAdscripCliente = Integer.parseInt(request.getParameter("Departamento"));
//date FechaInicio =Date.parseDate(request.getParameter("Fecha Inicio"));
//date FechaTerminacion =Date.parseDate(request.getParameter("Fecha Terminacion"));
int IdResponsablePrueba = Integer.parseInt(request.getParameter("Responsable de Prueba"));
//date FechaPrueba =Date.parseDate(request.getParameter("Fecha de Prueba"));
int IdResponsableAprobacion = Integer.parseInt(request.getParameter("Responsable de Aprobacion"));
int IdResponsableLiberacion = Integer.parseInt(request.getParameter("Responsable de Liberacion"));
//date FechaLiberacion =Date.parseDate(request.getParameter("Fecha de Liberacion"));
int IdResponsableEvaluacion = Integer.parseInt(request.getParameter("Responsable de Evaluacion"));
String PeriodoEvaluacion = request.getParameter("Periodo de Evaluacion");
String Observaciones = request.getParameter("Observaciones");
String Tipo = request.getParameter("Tipo");
// insert into tabla() values();
String q="insert into proyecto(Nombre,Institucion,Clave,IdAdscripcion,IdAdscripResponsable,IdJefeProyecto,EquipoApoyo,IdCliente,IdAdscripCliente,IdResponsablePrueba,IdResponsableAprobacion,IdResponsableLiberacion,IdResponsableEvaluacion,PeriodoEvaluacion,Observaciones,Tipo)
values("" +Nombre+"","+Institución+","+Clave+","+IdAdscripcion+","+IdAdscripResponsable+","+IdJefeProyecto+","+Equipo de Apoyo+","+IdCliente+","+IdAdscripCliente+","+FechaInicio+","+FechaTerminacion+","+ResponsablePrueba+","+FechaPrueba+","+ResponsableAprobacion+","+ResponsableLiberacion+","+FechaLiberacion+","+IdResponsableEvaluacion+","+Periodo de Evaluacion+","+Observaciones+","+Tipo+"); ";
