[Gambas-user] Postgresql date question

richard terry rterry at ...1946...
Mon Jul 21 02:23:00 CEST 2008


On Sun, 20 Jul 2008 08:30:20 am Pino Zollo wrote:
> Alle 17:51, giovedì 17 luglio 2008, richard terry ha scritto:
> > insert into mytable (date1, date2) values
> >
> > ('01/01/2008','00:00:00')
>
> What about
> insert into mytable (date1, date2) values ('01/01/2008', NULL)
Yes, of course, that works in the pgadmin window but not in gambas as I 
couldnt find a way to get the NULL in easily, maybe you can explain how you 
do it.

However I have found that this works, but it is not very elegant when it comes 
to a table with 6 -7 date fields (I'm doing a work-cover form which has a 
multitutde of different dates  eg fit_preinjury_from, unfit_from, unfit_to, 
suitableduties_from, suitableduties_to, fit_premanantly modified duties_from, 
review_date, review_treatmentdate (NSW govt Workcover requirements!!!!) any 
one of which could be null.

Anway, comments welcome.


 Public Sub Temp()
'---------------------------------------------------------------------------
'temporary routine to play with dates
' gvar is a global variable in my program as a connection
' ModDBConnect is where I keep db access routines
'---------------------------------------------------------------------------
  Dim date1 As Date
  Dim date2 As Date
  Dim sql as string
  date2 = Val("10/02/2008")    'put real date here
  
  sql = "insert into clin_workcover.temp (date1, date2)  VALUES("
   If IsNull(date1) Then
      sql = sql & gvar.$hConn.Subst("&1", Null)
   End If
  sql  = sql & ",'" & date2 & "')"
  Print sql
 $Result = modDBConnect.exec_query(sql)

  
 End
>
> Maybe you want the type timestamp ...which is the set of a date and a time.
>
> Good luck
> Pino
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's
> challenge Build the coolest Linux based applications with Moblin SDK & win
> great prizes Grand prize is a trip for two to an Open Source event anywhere
> in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user






More information about the User mailing list