Scheduler for WinForms

Store appointments properties

  •  sweish said 2 years, 2 months ago:

    Can anyone please tell me how to store the appointment properties like label,resources,contacts,etc in the database and retriewve it through code( not using tableadapter).

    Thank You.

  •  C1_IrinaP25p said 2 years, 2 months ago:

    By default C1Scheduler persists all appointment properties in xml format into your data source if you set mapping for AppointmentProperties (it should be big text field). You can implement other logic, but we have no such samples.

    I'm not sure that I understand what do you mean by "retreive through code". Look at Appointment class documentation – there is a description for every property.

  •  sweish said 2 years, 2 months ago:

    Sorry i didnt see the property for giving mapping name for properties. I am retrieving the data from database using the below code,

    dim ds_appointment as new dataset

    dim da_appointment as new mysqldataadapter("select * from appointments",myconnection)

    da_appointment.fill(ds_appointment)

    dim dt as new datatable

    dt=ds.tables("appointments")

    Me.C1Schedule1.DataStorage.AppointmentStorage.DataMember = "Appointments" Me.C1Schedule1.DataStorage.AppointmentStorage.DataSource = ds_appointment Me.C1Schedule1.DataStorage.AppointmentStorage.Mappings.Body.MappingName = "Body" Me.C1Schedule1.DataStorage.AppointmentStorage.Mappings.End.MappingName = "End" Me.C1Schedule1.DataStorage.AppointmentStorage.Mappings.IdMapping.MappingName = "Id" Me.C1Schedule1.DataStorage.AppointmentStorage.Mappings.Location.MappingName = "Location" Me.C1Schedule1.DataStorage.AppointmentStorage.Mappings.Start.MappingName = "Start" Me.C1Schedule1.DataStorage.AppointmentStorage.Mappings.Subject.MappingName = "Subject"

    Me.C1Schedule1.DataStorage.AppointmentStorage.datamember="appointments"

    Me.C1Schedule1.DataStorage.AppointmentStorage.datasource=dt

    While retrieving there is no problem. Because while testing i have manually entered the data into database. Now my problem hpw should i insert the data into database programatically, ie, i want to use like,

    myconnection.Open()

               Dim cmd_status As New MySqlCommand(query, myconnection)

               result_manipulation = cmd_status.ExecuteNonQuery()

               myconnection.Close()

    In query i want to write insert statement,

    query="Insert into appointments(id,body,end,start,location,subject,property) values()

    In which event can i get the body,start,end,etc values? and how to create the property value? IS it mandatory that a unique id should be generated for ID field?

  •  sweish said 2 years, 2 months ago:

    Sorry, i am new to component one. this is the first time i am using it. If i write it in appointment_added event will it be correct?

    How to create the property field in XML field.can i create it manually using the property tags, if so  is their any order to write the properties in XML format?

  •  C1_IrinaP25p said 2 years, 2 months ago:

    You should have one more varchar column in your database. The mapping should look like this:

    c1Schedule1.DataStorage.AppointmentStorage.Mappings.AppointmentProperties.MappingName
    = "Properties"

    Look at your code :

    dt=ds.tables("appointments")

    You have DataSet and "appointments" DataTable. Your "appointments" DataTable contains all data you need to save them into underlying database. I.e. you should take column value and use it as a SqlCommand parameter. You can use either C1Schedule.AppointmentAdded, etc.. events, or DataTable events.

    Answer
  •  sweish said 2 years, 2 months ago:

    Thank you so much.. Forum is excellent.. Thanks for the immediate reply

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.