dbf insert datetime query

时间:2012-06-29 08:03:36

标签: c# datetime ado.net insert dbf

我有一个简短的问题。我如何插入包含日期时间类型的值? 我试过这个:

>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'

但是这个将空白值放入表中:

  

Dus_r = CTOT('2009-07-15 00:00:00')

我的简短问题:我做错了什么?

这是我的连接字符串:

  

Provider = vfpoledb.1;数据源= D:\ transmisja \ skawina4 \ W \ wkono.dbf;整理顺序=机器

使用.net 4.0 windows form c#application

进行ado.net连接

2 个答案:

答案 0 :(得分:1)

查看documentation看起来日期时间是TZ格式,所以我想通过更改为以下内容它可能会开始工作:

Dus_r = CTOT('2009-07-15T00:00:00')

注意在日期和时间之间添加了

或者

Dus_r = CTOT('2009-07-15T00:00:00Z')

注意T在日期和时间之间添加,Z在时间之后添加

答案 1 :(得分:0)

就像贴片机一样,我需要更正我的查询:

更新D:\ transmisja \ skawina4 \ W \ wkono.dbf set kod_kontr = '21 -0005',Nzwakontr1 ='KlimekWacław',Nzwakontr2 ='',Adrknth_m ='RADZISZÓW',Adrknth_u ='SKAWIŃSKA44gg', 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ŃSKA44',Dus_p = CTOT('2009-05-01T'),Dus_r = CTOT('2109-06-20T')其中kod_kontr = '21 -0005'

当我构建此查询时,我需要的是: Dus_p = CTOT('“+ Dus_p.ToString(”d“)+”T“),Dus_r = CTOT('”+ Dus_r.ToString(“d”)+“T')

现在一切都运转良好。感谢贴片机的帮助!