Hi,
I just started developing with the SmartClient a few days ago and I'm having some trouble with the Date type saving the correct values in a SQL Server.
I'm trying to build an editable ListGrid, where you can add/delete entries and edit the entries by doubleclicking. For the dates I have defined them as type:date to be able to use that datechooser widget. After the editing is done, it should automatically update the database entry with the changed values. The values loaded from the database and the value (and validation by the field) while editing the field are correrct, but the value saved in the database is not correct.
If I try to save today's date (16.02.2012) the field's validation accepts the input, but the SQL Server returns an error saying the datetime gotten from converting the varchar type is out of bounds.
It seems like the SQL Server expects a different format for the date-string for the its update statement.
Is there a way to change the format of the date-string (after being done with editing the cell and) before it is sent to the database?
SmartClient version:
SC_SNAPSHOT-2012-02-08_v8.2p
Browser:
Internet Explorer 6.0
Server logs:
Server Log.txt (attachment)
RPC response:
RPC log.txt (attachment)
JavaScript StackTrace:
No Errors
Sample code:
Datasource XML:
ListGrid from the JavaScript File:
I have noticed 2 similar older topics and I tried to extend the server properties file by using the code provided in the answer, but it has no effect.
http://forums.smartclient.com/showthread.php?t=14188
http://forums.smartclient.com/showthread.php?t=14727
I just started developing with the SmartClient a few days ago and I'm having some trouble with the Date type saving the correct values in a SQL Server.
I'm trying to build an editable ListGrid, where you can add/delete entries and edit the entries by doubleclicking. For the dates I have defined them as type:date to be able to use that datechooser widget. After the editing is done, it should automatically update the database entry with the changed values. The values loaded from the database and the value (and validation by the field) while editing the field are correrct, but the value saved in the database is not correct.
If I try to save today's date (16.02.2012) the field's validation accepts the input, but the SQL Server returns an error saying the datetime gotten from converting the varchar type is out of bounds.
It seems like the SQL Server expects a different format for the date-string for the its update statement.
Is there a way to change the format of the date-string (after being done with editing the cell and) before it is sent to the database?
SmartClient version:
SC_SNAPSHOT-2012-02-08_v8.2p
Browser:
Internet Explorer 6.0
Server logs:
Server Log.txt (attachment)
RPC response:
RPC log.txt (attachment)
JavaScript StackTrace:
No Errors
Sample code:
Datasource XML:
Code:
<DataSource schema="dbo" dbName="mssql1" tableName="Provisionsstammdaten" ID="provisionsstammdaten_v1" serverType="sql" > <fields> <field name="LFDNR" type="sequence" title="Laufende Nr." hidden="true" primaryKey="true" /> <field name="KDNR" type="integer" title="Kundennr." required="true" /> <field name="ARTNR" type="text" title="Artikelnr." /> <field name="PREIS" type="floatdec" title="Preis" /> <field name="ABSCHLAG" type="floatdec" title="Abschlag" /> <field name="TYP" type="text" title="Typ" /> <field name="FIRMA" type="text" title="Firma" /> <field name="ERLANGEN" type="floatdec" title="Erlangen" /> <field name="ZAT" type="floatdec" title="ZAT" /> <field name="GUELTIG_VON" type="date" title="Gültig von" /> <field name="GUELTIG_BIS" type="date" title="Gültig bis" /> </fields> </DataSource>
Code:
Date.setShortDisplayFormat("toEuropeanShortDate"); Date.setInputFormat("DMY"); isc.ListGrid.create({ ID: "listgrid_provisionsstammdaten", width:"100%", height:"100%", dataSource: provisionsstammdaten_v1, autoFetchData:true, canEdit:true, modalEditing: true, autoDraw:false, fields: [ {name:"KDNR", width:100, align:"right"}, {name:"ARTNR", width:100, align:"right"}, {name:"PREIS", width:100, align:"right", formatCellValue:function (value) { if (isc.isA.Number(value)) { return value.toCurrencyString(" ",","); } return value; } }, {name:"ABSCHLAG", width:100, align:"right"}, {name:"TYP", width:100, align:"right"}, {name:"FIRMA", width:100, align:"right"}, {name:"ERLANGEN", width:100, align:"right"}, {name:"ZAT", width:100, align:"right"}, {name:"GUELTIG_VON", width:100, type:"date"}, {name:"GUELTIG_BIS", width:100, type:"date"} ], dataPageSize:100 })
http://forums.smartclient.com/showthread.php?t=14188
http://forums.smartclient.com/showthread.php?t=14727
Code:
sql.mssql1.defaultDateFormat: yyyyMMdd sql.mssql1.defaultDateTimeFormat: yyyyMMdd HH:mm:ss
Comment