I need store 10 data into database
current is my stupid code:
query="""
INSERT INTO [dbo].[RubberFuYeWidthData]
([RecordID]
,[SerNum]
,[Pcs]
,[IndexN]
,[Measured]
,[RecordTime])
VALUES
(?
,?
,?
,?
,?
,SYSDATETIME())
"""
RecordID=event.source.parent.RecordID
SerNum=event.source.parent.getComponent('SerNum').text
Pcs=event.source.parent.getComponent('PCS').value
Measured1=event.source.parent.getComponent('Measure1').floatValue
Measured2=event.source.parent.getComponent('Measure2').floatValue
Measured3=event.source.parent.getComponent('Measure3').floatValue
Measured4=event.source.parent.getComponent('Measure4').floatValue
Measured5=event.source.parent.getComponent('Measure5').floatValue
Measured6=event.source.parent.getComponent('Measure6').floatValue
Measured7=event.source.parent.getComponent('Measure7').floatValue
Measured8=event.source.parent.getComponent('Measure8').floatValue
Measured9=event.source.parent.getComponent('Measure9').floatValue
Measured10=event.source.parent.getComponent('Measure10').floatValue
args1=[RecordID,SerNum,Pcs,1,Measured1]
args2=[RecordID,SerNum,Pcs,2,Measured2]
args3=[RecordID,SerNum,Pcs,3,Measured3]
args4=[RecordID,SerNum,Pcs,4,Measured4]
args5=[RecordID,SerNum,Pcs,5,Measured5]
args6=[RecordID,SerNum,Pcs,6,Measured6]
args7=[RecordID,SerNum,Pcs,7,Measured7]
args8=[RecordID,SerNum,Pcs,8,Measured8]
args9=[RecordID,SerNum,Pcs,9,Measured9]
args10=[RecordID,SerNum,Pcs,10,Measured10]
system.db.runPrepUpdate(query,args1,'EHCMES')
system.db.runPrepUpdate(query,args2,'EHCMES')
system.db.runPrepUpdate(query,args3,'EHCMES')
system.db.runPrepUpdate(query,args4,'EHCMES')
system.db.runPrepUpdate(query,args5,'EHCMES')
system.db.runPrepUpdate(query,args6,'EHCMES')
system.db.runPrepUpdate(query,args7,'EHCMES')
system.db.runPrepUpdate(query,args8,'EHCMES')
system.db.runPrepUpdate(query,args9,'EHCMES')
system.db.runPrepUpdate(query,args10,'EHCMES')
I write 10 times the code, how to use a smart solution to improve? thanks a lot