Insert Fecha en SQL
Publicado por Ramiro Polverini (20 intervenciones) el 14/07/2005 00:38:44
Buenas.... Necesitaria que alguien me de una manito. Estoy tratando de hacer un INSERT en una database firebird con c#. Con Campos de tipo VARCHAR no tengo problema, grabo directamente los strings de c#. El tema es cuando quiero grabar un campo tipo DATE en la database ¿Como se hace el INSERT???
Yo lo estoy haciendo de esta manera y me da error en la conversion(la libreria de FireBird):
Conectar.ComandoSQL("INSERT INTO VEHICULOS (NROPATENTE,MARCA,MODELO,ANIO,VTVNRO,VTVVTO,RUTANRO,RUTAVTO,POLIZASEGNRO,GNCNRO,GNCVTO) VALUES ('"+this.Patente.Text+"','"+this.Marca.Text+ "','"+this.Modelo.Text+ "','"+this.Año.Text+ "','"+this.VTVNro.Text+ "','"+DateTime.Parse( this.VTVVto.Text).ToShortDateString()+"','"+ this.RUTANro.Text +"','"+DateTime.Parse( this.RutaVto.Text).ToShortDateString()+"','"+ this.Seguro.Text +"','"+ this.GNCNro.Text +"','"+DateTime.Parse( this.GNCVto.Text ).ToShortDateString()+"')");
Desde ya Gracias de antemano
Yo lo estoy haciendo de esta manera y me da error en la conversion(la libreria de FireBird):
Conectar.ComandoSQL("INSERT INTO VEHICULOS (NROPATENTE,MARCA,MODELO,ANIO,VTVNRO,VTVVTO,RUTANRO,RUTAVTO,POLIZASEGNRO,GNCNRO,GNCVTO) VALUES ('"+this.Patente.Text+"','"+this.Marca.Text+ "','"+this.Modelo.Text+ "','"+this.Año.Text+ "','"+this.VTVNro.Text+ "','"+DateTime.Parse( this.VTVVto.Text).ToShortDateString()+"','"+ this.RUTANro.Text +"','"+DateTime.Parse( this.RutaVto.Text).ToShortDateString()+"','"+ this.Seguro.Text +"','"+ this.GNCNro.Text +"','"+DateTime.Parse( this.GNCVto.Text ).ToShortDateString()+"')");
Desde ya Gracias de antemano
Valora esta pregunta


0