Problem working with SQL Server time datatype Help please

Posted by: szilbermints on 9 August 2019, 5:09 am EST

  • Posted 9 August 2019, 5:09 am EST

    Hi

    I have table with time(7) datatype which keeps times only like : 01:00;00 or

    22:00:00.

    When i extract it to webspread it shows ok, but when try to save it produces error message “Error Converting Syste,DateTime to Time.Span” i tried to create custom datetime type for a column and set formatstring to “HH;mm” but does not help

    Thank You Much

  • Posted 11 August 2019, 7:04 pm EST

    Hi,

    Please use the DateTimeCellType and set the Format to HH:mm:ss. Please refer to the following code snippet and the attached sample for reference.

     DateTimeCellType dateTimeCell = new DateTimeCellType();
                    dateTimeCell.FormatString = "HH:mm:ss";
                    StyleInfo style = new StyleInfo();
                    style.CellType = dateTimeCell;
                    FpSpread1.ActiveSheetView.SetStyleInfo(-1, 3, style);
    

    If the issue persists, please modify the attached sample so that we may assist you accordingly.

    Hope it helps!

    Regards,

    Manish Gupta

    SpreadDateTimeCellType.zip

  • Posted 12 August 2019, 1:05 am EST

    Thank You Manish,

    Unfortunately it does not fix my problem.

    Your code works fine when SQL Server database type is “datetime” which contains both date and time. BUT In my case as i tried to indicate originally the datatype is “time(7)”

    which stores hours and minutes and seconds like “11:00:00” or “23:00:00”.

    Thank You

  • Posted 12 August 2019, 11:48 pm EST

    Hi,

    Thank you for your patience while we are investigating on your issue. We will let you know as soon as we have any update for you.

    Regards,

    Manish Gupta

  • Posted 13 August 2019, 5:34 pm EST

    Hi,

    We are sorry for the inconvenience, the issue required investigation by the development team. Hence, we have forwarded it to the development team with internal tracking id 274966.

    We will let you know as we have an update on this.

    Regards,

    Manish Gupta

  • Posted 14 August 2019, 8:04 am EST

    Thank You for looking into this

  • Posted 20 August 2019, 3:05 pm EST

    Hi,

    We are sorry for the inconvenience because of the delayed response. We required to create a custom CellType which required to parse the value to TimeSpan.

    Please refer to the attached sample <TimeCellType.zip> for reference.

    Regards,

    Manish Gupta

  • Posted 22 August 2019, 4:53 am EST

    Thank You Manish

    I tried to run the sample but since my version is: 5.0.3542 it says that “trial expired”

    So, practically can you confirm that i need to do the following steps and it would w ork?

    1.Add this " public class TimeCellType : BaseCellType"

    2.Add 2 htc and 2 js files to the projcet

    that is all?

    Thank You

  • Posted 22 August 2019, 5:23 pm EST

    Hi,

    We are sorry, the Spread Version (Spread ASP.NET 5), you are using is Quite older. But it should have the BaseCellType and procedure should be similar to the attached project in previous reply since DateTimeCellType was working fine.

    Hence, you may create TimeCellType class in your project and add related htc and js files to the project.

    Regards,

    Manish Gupta

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels