Error when added new appointment

7 posts, 1 answers
  1. Dave Mortgatta
    Dave Mortgatta avatar
    16 posts
    Member since:
    Aug 2009

    Posted 17 Apr 2012 Link to this post

    I used code from example and got error when trying to add a new appointment.

    Thank for you help...

    Unable to cast object of type 'System.Guid' to type 'System.IConvertible'.Couldn't store <5303d57e-81d4-4399-9b50-cbade2462a09> in ID Column.  Expected type is Int32.
  2. Answer
    Dave Mortgatta
    Dave Mortgatta avatar
    16 posts
    Member since:
    Aug 2009

    Posted 17 Apr 2012 Link to this post

    Please disregard with this question. I followed the article here and fixed the issues.

    http://www.telerik.com/help/winforms/scheduler-data-binding-binding-to-access-db-(tips-and-tricks).html


  3. UI for WinForms is Visual Studio 2017 Ready
  4. Stefan
    Admin
    Stefan avatar
    2890 posts

    Posted 20 Apr 2012 Link to this post

    I am glad that you have found the right way to go. 

    Should you have any other questions, do not hesitate to contact us.

    Regards,
    Stefan
    the Telerik team
    RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
  5. Allen
    Allen avatar
    14 posts
    Member since:
    Aug 2012

    Posted 03 Dec 2012 Link to this post

    i have the same problem, i'm using int as my ID(primary, identity, increment 1) and SQLCE as my database.

    My datasource is created at runtime including the Relation (so that i can display/edit Exceptions),

    the error is the same as Dave mentioned. though i'm not saving any GUID. My Mappings are correct. i check, rechecked and rechecked to make sure i'm saving all of the data in the proper column with the proper datatype.

    adding the appointment is fine, no errors, but after saving the appointment, the "Unable to cast object of type" is shown. the error is pointed at the Application.Run on Program.CS. so i know (i think) that may mappings are correct and that no GUID is saved into my database

    How can this be solved? Thanks!

  6. Ivan Todorov
    Admin
    Ivan Todorov avatar
    688 posts

    Posted 05 Dec 2012 Link to this post

    Hello Rhea,

    This exception is likely to be thrown if you map the UniqueId property of the appointments to the ID column in the database. If you have such mapping, please try removing it. In case you need further assistance, please open a new support ticket and attach a sample project that demonstrates your case. This will let me investigate it and provide you with further support.

    Let me know if I can assist you further.

    Kind regards,
    Ivan Todorov
    the Telerik team
    Q3’12 of RadControls for WinForms is available for download (see what's new). Get it today.
  7. Allen
    Allen avatar
    14 posts
    Member since:
    Aug 2012

    Posted 05 Dec 2012 Link to this post

    Hi Ivan,

    I cannot remove my ID mapping, or the Appointments will not load.

    I did not actually solved my problem, but i just returned my ID data type to accept GUID. The error does not appear anymore. But i would really prefer if my ID data type is of INT (primary, increment of 1).

    The sample in your demo uses INT for your ID. But in my case, it returns an error.

    If you still want a sample project, let me know.

    Thank You
  8. Ivan Todorov
    Admin
    Ivan Todorov avatar
    688 posts

    Posted 07 Dec 2012 Link to this post

    Hi Rhea,

    The UniqueId field should not affect loading the appointments in any manner. This is a field that is used internally in some specific cases (for example, to distinguish appointments that have the same start date, end date, summary, etc.). In the general case, you do not need to store this field in your database. In our examples this field is mapped to an integer column, but there is some special code that handles storing the ID of the newly added appointments (which have an automatically generated UniqueId of type GUID). Please check the Adapter_RowUpdated handler in the source code of the example.

    Yes, making the ID column of your data table accept GUIDs will prevent the exception, but I would rather suggest adding another GUID column to store the UniqueId because in some cases having an auto-increment key column is vital for database performance.

    If you consider the case is not resolved or if there is still anything that is not clear, and if you think that you can invest some time in creating a sample project, I will be glad to investigate it and suggest what should be modified. So please feel free to contact us if you need further support.

    Kind regards,
    Ivan Todorov
    the Telerik team
    Q3’12 of RadControls for WinForms is available for download (see what's new). Get it today.
Back to Top
UI for WinForms is Visual Studio 2017 Ready