Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

timestamp error 1

Status
Not open for further replies.

bakira4

Programmer
May 19, 2008
8
FR
hi,
I'm very happy to find finnaly an active forum about pervasive programation.

I'have an ODBC database Connexion and I try to request on it with this:

queryInsLigne = "INSERT INTO LIGNE (TypeMouvement, PiecePrefixe, PieceNumero, IP, TypeLigne, CodeArt, Libelle, CDate, Quantite, CodeDepot, Commentaire, QteInventaire) VALUES ('" & rsCType.Fields(0) & "','INV','" & numPiece.Text & "','" & ip & "','1','" & code & "','" & designation & "','" & Date & "','" & qtt & "','" & depot.codeDepot & "','inventaire portable','" & qtt & "')"

but I receive an "invalid date, time or timestamp value" error...

I have already read an another thread about this error in this forum but the given solution doesn't work with me.
Someone can help me?
 
What does the actual SQL statement look like with the values? I'm going to guess that the "Date" field is not in the format PSQL needs.

Mirtheil
Certified Pervasive Developer
Certified Pervasive Technician
 
It looks like that:

INSERT INTO LIGNE (TypeMouvement, PiecePrefixe, PieceNumero, IP, TypeLigne, CodeArt, Libelle, CDate, Quantite, CodeDepot, Commentaire, QteInventaire)
VALUES (' ','INV','9','1','1','DESK','Beautifull Desk','20/05/2008','15','1','inventaire portable','15')

I trye to insert this into table LIGNE where the date format is like this dd/mm/yy
 
The PSQL date format needs to be 'yyyy-mm-dd'. It also needs to include the single quotes. So the statement needs to be:
INSERT INTO LIGNE (TypeMouvement, PiecePrefixe, PieceNumero, IP, TypeLigne, CodeArt, Libelle, CDate, Quantite, CodeDepot, Commentaire, QteInventaire)
VALUES (' ','INV','9','1','1','DESK','Beautifull Desk','2008-05-20','15','1','inventaire portable','15')

Mirtheil
Certified Pervasive Developer
Certified Pervasive Technician
 
Thanks a lot, it works!!!
I insert date with 'yyyy-mm-dd' format
and in my row it's automatically converted in the 'dd/mm/yy'.
once again thanks mirtheil
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top