Syntax error converting datetime from character string.

G

Guest

i have windows application that read values from XML and generated the
following statement

Insert into lyric_Table(tID,CD, CeID, BkID, ChaID,ToID, SubID, ArtID,
PrBY,PrDate ,AFlag,ADate,ABY,ADate,
ApFlag,ApBY,Address,Type,Usr,KeyWord,Stat,Descr,Height,Path )
Values('1029','0','0','1031','1752','0','0','0','','07/09/2005 04:16:10
Ù…','0','01/01/1900','','01/01/1900','0','','991.xls
','12','','','1','','0','lyric\1030')

Error : Syntax error converting datetime from character string.

all date value fields are datetime type
 
W

W.G. Ryan - MVP

Raed - IMHO you're best bet is first to paramaterize the query using:
Insert into lyric_Table(tID,CD, CeID, BkID, ChaID,ToID, SubID, ArtID,
PrBY,PrDate ,AFlag,ADate,ABY,ADate,
ApFlag,ApBY,Address,Type,Usr,KeyWord,Stat,Descr,Height,Path )
Essentially, change the Sql Statement, then for each value, just use the
real type that it is in the database and you should be ok. As an aside, I
copied this and got some weird behavoir b/c of the unicode characters that
came through - but when I converted everythign to date time, I got it to
insert just as I'd expect.

Param Value
tID 1029'
CD '0'
CeID '0'
BkID '1031'
ChaID '1752'
ToID '0'
SubID '0'
ArtID '0'
PrBY ''
PrDate '07/09/2005 04:16:10 ?'
AFlag '0'
ADate '01/01/1900'
ABY ''
ADate '01/01/1900'
ApFlag '0'
ApBY ''
Address '991.xls '
Type '12'
Usr ''
KeyWord ''
Stat '1'
Descr ''
Height '0'
Path lyric\1030'

Values('@tID,@CD,@CeID,@BkID,@ChaID,@ToID,@SubID,@ArtID,@PrBY,
@PrDATE,@AFlag,@ADate,@ABY,@ADate,'991.xls
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top