Reputation: 415
I' ve got a short question. How could I insert values contain a datetime type? I've tried this one:
>update D:\\transmisja\\skawina4\\W\\wkono.dbf set kod_kontr = '21-0003',
Nzwakontr1 = 'Kmiecik Wieslaw', Nzwakontr2 = '' , Adrknth_m ='RADZISZÓW',
Adrknth_u = 'JANA PAWLA II 1', NrDomu='', Nrlok='', Adrknth_k='32-052',
Nr_vat =' -', Telkontr ='- -', Nrkonkontr='200 21 0003', Bank ='',
NrKonta = '', Osw = '', Sz = '', Region = '', Upust = 0.0, TerminP = 0,
Poziomcen =0, PlatnikVAT =.f., Warunki1 ='175/A/00', Warunki2 ='2000.12.30',
Obwod = '21', Grupa = 'P1', Us_p ='--', Zus_p = .t., Us_r ='IO', Zus_r = .t.,
Rdziel = '--', Rulica ='JANA PAWLA II 1', Dus_p = CTOT('1993-03-12 00:00:00'),
Dus_r = CTOT('2009-07-15 00:00:00') where kod_kontr='21-0003'
But this one puts blank value into table:
Dus_r = CTOT('2009-07-15 00:00:00')
My short question: What I'm doing wrong?
This is my connection string:
Provider=vfpoledb.1;Data Source=D:\transmisja\skawina4\W\wkono.dbf;Collating Sequence=machine
And it is ado.net connection using by .net 4.0 windows forms c# application
Upvotes: 1
Views: 1509
Reputation: 415
Like mounters said I need correct my query for that:
update D:\transmisja\skawina4\W\wkono.dbf set kod_kontr = '21-0005', Nzwakontr1 = 'Klimek Wacław', Nzwakontr2 = '' , Adrknth_m ='RADZISZÓW', Adrknth_u = 'SKAWIŃSKA 44gg', NrDomu='', Nrlok='', Adrknth_k='32-052', Nr_vat =' -', Telkontr ='', Nrkonkontr='200 21 000522', Bank ='', NrKonta = '', Osw = '', Sz = '', Region = '', Upust = 0.0, TerminP = 0, Poziomcen =0, PlatnikVAT =.f., Warunki1 ='238/S/2005', Warunki2 ='4,11,2005', Obwod = '21', Grupa = 'P1', Us_p ='--', Zus_p = .t., Us_r ='IO', Zus_r = .t., Rdziel = '', Rulica ='SKAWIŃSKA 44', Dus_p = CTOT('2009-05-01T'), Dus_r = CTOT('2109-06-20T') where kod_kontr='21-0005'
when I' ve built this query I' ve needed is: Dus_p = CTOT('" + Dus_p.ToString("d") + "T'), Dus_r = CTOT('" + Dus_r.ToString("d") + "T')
Now everything is working well. Thanks mounters for help!
Upvotes: 0
Reputation: 18349
Looking at the documentation it looks like the datetime is in TZ format so I think by changing to the following it might just start to work:
Dus_r = CTOT('2009-07-15T00:00:00')
NOTE T added between date and time
or perhaps
Dus_r = CTOT('2009-07-15T00:00:00Z')
NOTE T added between date and time, and Z after time
Upvotes: 1