como insertar en un campo tipo datetime

03/09/2004 - 18:29 por leon | Informe spam
Saludos listeros, cómo inserto en un campo tipo datetime, ya que al momento
lo estoy haciendo
sin darle formato y lo inserta 01/01/1900.

Tengo que darle formato o algo por el estilo?.

de antemano os agradezco,

saludos.

leon.

Preguntas similare

Leer las respuestas

#11 Javier Loria
07/09/2004 - 01:30 | Informe spam
Hola:
ANSI: American National Standard Institute
ISO: International Organization for Standarization

Javier Loria
Costa Rica
Se aprecia la inclusion de DDL (CREATE, INSERTS, etc.)
que pueda ser copiado y pegado al Query Analizer.
La version de SQL y Service Pack tambien ayuda

"leon" wrote in message
news:
y 112 es ?, perdona la ignorancia.

saludos,

leon


"Maxi" wrote in message
news:
> oye, usa 112 y no 103, ya que 112 es ANSI ;-)
>
>
> Salu2
> Maxi
> Buenos Aires - Argentina
> Desarrollador Microsoft 3 Estrellas .NET
> Nunca consideres el estudio como una obligación sino como
> una oportunidad para penetrar en el bello y maravillosos
> mundo del saber.
> - Albert Einstein
>
>
>
> "leon" escribió en el mensaje
> news:
> > Listeros muchas gracias por la ayuda, ya solucioné el problema.
> > fué así:
> >
> > Primero declaré una variable:
> > String sDate = DateTime.Now.ToString("MM/dd/yyyy");
> >
> > y en el insert, lo hice de esta manera:
> > INSERT INTO VALUES ( CONVERT(DATETIME,'" + sDate + "',103) )
> >
> >
> > Os agradezco mucho listeros.
> >
> > leon.
> >
> >
> >
> > "leon" wrote in message
> > news:
> > > Hola salvador. mira esta es la instruccion como lo estoy haciendo:
> > >
> > > strSQLCC= "INSERT INTO
> > >
> >
>



tblPayment(intIDReference,intIDUser,dtDateTrx,sngValue,strPaymentType,strTyp
> > >
> >
>



eCheck,strBankName,strAccType,strRoutingNumber,strCheckNumber,strBankAccNumb
> > >
> >
>



er,strCCNumber,strCCType,lngCCIdNum,strExpDate,strFirstNameBill,strLastNameB
> > >
> >
>



ill,strPhoneBill,strStateBill,strCityBill,strCompanyBill,strAddressBill)VALU
> > > ES("+Invoice+","+ IDUSER+", "+ DateTx + ", "+ Amount +",'Credit
> > > Card',null,null,null,null,null,null,'"+ tbCCNumber.Text +"','"+
> > > ddlTypeCCard.SelectedItem.Text+"','"+ tbccID.Text +"','"+ ExpDate
> +"','"+
> > > tbFirstName.Text +"','"+ tbLastName.Text +"','"+ tbPhonBill.Text
+"','"+
> > > ddlState.SelectedItem.Text.Trim() +"','"+ tbCity.Text +"','"+
> > tbCompany.Text
> > > +"','"+ tbAddresBill.Text +"')";
> > >
> > > es el tercer campo.
> > >
> > > saludos y gracias por la ayuda.
> > >
> > > leon.
> > >
> > >
> > >
> > > "Salvador Ramos" wrote in
message
> > > news:%
> > > > Podrías explicar como lo estás insertando ? a que te refieres con
"sin
> > > darle
> > > > formato". Sería aconsejable que pusieras aquí la instrucción que
estás
> > > > ejecutando.
> > > >
> > > > Un saludo
> > > > Salvador Ramos
> > > > Murcia - España
> > > > [Microsoft MVP SQL Server]
> > > > www.helpdna.net
> > > > ¿Te interesa participar en las reuniones
> > > > del grupo de Usuarios de SQL-Server y .NET
> > > > Se harán en levante de España, (Alicante o Murcia)?
> > > >
> > > > "leon" escribió en el mensaje
> > > > news:
> > > > > Saludos listeros, cómo inserto en un campo tipo datetime, ya que
al
> > > > momento
> > > > > lo estoy haciendo
> > > > > sin darle formato y lo inserta 01/01/1900.
> > > > >
> > > > > Tengo que darle formato o algo por el estilo?.
> > > > >
> > > > > de antemano os agradezco,
> > > > >
> > > > > saludos.
> > > > >
> > > > > leon.
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>
>
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.748 / Virus Database: 500 - Release Date: 04/09/2004
>
>


email Siga el debate Respuesta Responder a este mensaje
Ads by Google
Help Hacer una pregunta AnteriorRespuesta Tengo una respuesta
Search Busqueda sugerida