Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/303.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/amazon-s3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 将日期从JDateChooser插入MySql数据库_Java_C#_Mysql_Sql_Jdatechooser - Fatal编程技术网

Java 将日期从JDateChooser插入MySql数据库

Java 将日期从JDateChooser插入MySql数据库,java,c#,mysql,sql,jdatechooser,Java,C#,Mysql,Sql,Jdatechooser,您好,我不知道如何将一个日期从JDateChooser插入到mysql转换为接受mysql的格式。。。。。。 我和MVC fremework一起工作。。。我用下面的方法插入数据 我的驾驶课在哪 添加一个JTX文件只是为了尝试使用我的应用程序调用它 txtFecha2 (this.vistaAlumno.getTxtFecha2().getText()) 在视图中,我将每个组件都设置为它们的GET和SET方法,以便可以从另一个类中使用它们 JDateChooser称为jdFecha publi

您好,我不知道如何将一个日期从JDateChooser插入到mysql转换为接受mysql的格式。。。。。。 我和MVC fremework一起工作。。。我用下面的方法插入数据

我的驾驶课在哪

添加一个JTX文件只是为了尝试使用我的应用程序调用它

txtFecha2 (this.vistaAlumno.getTxtFecha2().getText())
在视图中,我将每个组件都设置为它们的GET和SET方法,以便可以从另一个类中使用它们

JDateChooser称为jdFecha

public void actionPerformed(ActionEvent e) {

        if (e.getSource() == vistaAlumno.getBtnInsertar()) {

            //obtiene ID de producto  this.mimodelo.getDatosVentaxFechas( this.frmconsulta.__fecha1.getDate(), this.frmconsulta.__fecha2.getDate() ) );
            //String cat[] = this.vistaAlumno.__lista_categorias.getSelectedItem().toString().split("-");
            if (this.modeloAlumno.NuevoProducto(
                    this.vistaAlumno.getTxtMatricula().getText(),
                    this.vistaAlumno.getTxtNombre().getText(),
                    this.vistaAlumno.getTxtApellido_p().getText(),
                    this.vistaAlumno.getTxtApellido_m().getText(),
                    this.vistaAlumno.getTxtSexo().getText(),
                    this.vistaAlumno.getTxtFecha2().getText(),
                    this.vistaAlumno.getTxtDireccion().getText(),
                    this.vistaAlumno.getTxtCorreo().getText()// ,
            // cat[0].trim()
            )) {
                this.vistaAlumno.getJtDatosAlumno().setModel(this.modeloAlumno.getTablaAlumno()); //actualiza JTable
                JOptionPane.showMessageDialog(null, "Nuevo Alumno Registrado");
            } else {
                JOptionPane.showMessageDialog(null, "Error: Verifique los datos del nuevo Alumno");
            }

您好,非常感谢

我不是在看您的代码,但是关于从JDateChooser添加日期,您可以使用此代码

String datee=((JTextField)a.getDateEditor().getUiComponent()).getText();
然后您可以将其添加到

ps.setString(0,a);
在上述代码中

一个是JDateChooser

ps是准备好的报表

希望能有帮助