Page 1 of 1

Problem with updatesql

Posted: 15.07.2008, 10:41
by khaled
hi
i have an error when i make this update code

DM_Sync.Update_Sec.Params[0].Value := 'ttttttt' ;
DM_Sync.Update_Sec.Params[1].Value := 'ttttttttttt' ;
DM_Sync.Update_Sec.Params[2].Value := 'ttttttttt' ;
DM_Sync.Update_Sec.Params[3].Value := 'ttttttt' ;
DM_Sync.Update_Sec.Params[4].Value := 'tttt' ;
DM_Sync.Update_Sec.Params[5].Value := 'ttttttttt' ;
DM_Sync.Update_Sec.Params[6].Value := 1 ;
DM_Sync.Update_Sec.Params[7].Value := 1 ;

DM_Sync.Update_Sec.Params[8].Value := now ;
DM_Sync.Update_Sec.Params[9].Value := 1 ;
DM_Sync.Update_Sec.Params[10].Value := 0 ;
DM_Sync.Update_Sec.Params[11].Value := 0 ;
DM_Sync.Update_Sec.Params[12].Value := 'tt' ;
DM_Sync.Update_Sec.Params[13].Value := 19 ;

DM_Sync.Query_Sec.Open ;
DM_Sync.Query_Sec.Edit ;
DM_Sync.Query_Sec.ApplyUpdates ;

and i got the error
Field check_out_time cannot be null
and its have a value

DM_Sync.Update_Sec.Params[8].Value := now ;

the previous code working normal on local mysql sever
but when connect to server its give the error

note
ZConnection1.AutoCommit = False

any body know how to solve this problem :?: :?: :?:

Posted: 15.07.2008, 15:38
by mdaems
Can you tell us a little more?

I see you use 2 components Update_Sec and Query_Sec. Are these 2 TZQuery components? In that case your setup is completely wrong, I think.

Or is Update_Sec a TZUpdateSQL component linked to Query_Sec?
In that case you don't have to set the Params but you should set DM_Sync.Query_sec.FieldByName('XXX').value := 'YYY'; between Edit and Applyupdates.

Mark

(Maybe posting your project sources as a zip file could help us as well to see what's wrong. Include database creation script.)

Posted: 16.07.2008, 17:24
by khaled
hi Mdaems


Update_Sec a TZUpdateSQL component linked to Query_Sec and Query_Sec is TZQuery
and i have assigned a parameters to the Update_Sec
where its has the sql code in the ModofiedSql Property

UPDATE jos_sections
SET

jos_sections.title = P1 ,
jos_sections.name = P2 ,
jos_sections.image = P3 ,
jos_sections.scope = P4 ,
jos_sections.image_position = P5 ,
jos_sections.description = P6 ,
jos_sections.published = P7 ,
jos_sections.checked_out = P8 ,
jos_sections.checked_out_time = P9 ,
jos_sections.ordering = P10 ,
jos_sections.access = P11 ,
jos_sections.count = P12 ,
jos_sections.params = P13

WHERE ( jos_sections.ID = P14 )


and when i use this command to execute in the modifiySql
DM_Sync.Query_Sec.Open ;
DM_Sync.Query_Sec.Edit ;
DM_Sync.Query_Sec.ApplyUpdates ;

and i got the error

field check_out_time Must have a value
and Finally i Found the solution for this problem

And its Here:

change all Fields Required In Query_Sec to
change the property Required = False for all fields in the Query_Sec where
Query_Sec is the query was linked to the TZUpdateSQL component

Very thanks mdaems
I appreciate your time