# Calender Dataset

**URL:** <https://forum.inductiveautomation.com/t/calender-dataset/4919>\
**Category:** Archived Topics\
**Created:** [August 1, 2012, 11:22pm UTC](https://forum.inductiveautomation.com/t/calender-dataset/4919 "2012-08-01T23:22:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tailfire](https://avatars.discourse-cdn.com/v4/letter/t/b5a626/32.png) [@tailfire](https://forum.inductiveautomation.com/u/tailfire)\
**Post date:** [August 1, 2012, 11:22pm UTC](https://forum.inductiveautomation.com/t/calender-dataset/4919/1 "2012-08-01T23:22:46Z")

</div>

id = event.source.parent.id  
Minfo = event.source.parent.getComponent(‘All one string’).text  
Mcolor = event.source.parent.getComponent(‘Selected Color’).text  
Mstart\_time = event.source.parent.getComponent(‘Start time’).text  
Mend\_time = event.source.parent.getComponent(‘End time’).text  
if Minfo == “”:  
system.gui.messageBox(“Please complete selection”)  
else:  
system.db.runPrepUpdate(“INSERT INTO Calender\_Dataset (startDate,endDate,displayColor,display) VALUES (?,?,?,?)”,Mstart\_time,Mend\_time,Mcolor,Minfo)  
system.nav.closeParentWindow(event)

I am trying to use the above code to insert into an MSSql Table.  
I get the following error about ‘coercing’ values.

java.lang.ClassCastException: java.lang.ClassCastException: Cannot coerce value ‘2012-06-20 17:30:00’ into type: class [Ljava.lang.Object;

What MS data format do my column need to be in SQL?

---

<div class="post-metadata">

**Author:** ![Travis.Cox](https://avatars.discourse-cdn.com/v4/letter/t/b9bd4f/32.png) [@Travis.Cox](https://forum.inductiveautomation.com/u/Travis.Cox)\
**Post date:** [August 2, 2012, 12:30am UTC](https://forum.inductiveautomation.com/t/calender-dataset/4919/2 "2012-08-02T00:30:03Z")

</div>

Change this line:`system.db.runPrepUpdate("INSERT INTO Calender_Dataset (startDate,endDate,displayColor,display) VALUES (?,?,?,?)",Mstart_time,Mend_time,Mcolor,Minfo)`to this:`system.db.runPrepUpdate("INSERT INTO Calender_Dataset (startDate,endDate,displayColor,display) VALUES (?,?,?,?)", [Mstart_time,Mend_time,Mcolor,Minfo])`Notice I added square brackets before and after the variables to make a list. The second argument of the runPrepUpdate is a list of values to substitute for each ?.
