have anyone tried ComponentOne Schedule.Net? I got this code from C1 in VB
but when I try in C1 I get this error:
Object reference not set to an instance of an object.
here is the VB code i received from them:
Private ds As DataSet
Private da As OleDbDataAdapter
Private dc As OleDbConnection
Private cb As OleDbCommandBuilder
Private cs As String
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
cs = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Nwind.mdb;Persist
Security Info=False"
dc = New OleDbConnection(cs)
da = New OleDbDataAdapter("Select * from Appointments", dc)
ds = New DataSet
da.Fill(ds)
Me.C1Schedule1.DataStorage.AppointmentStorage.Mapp ings.AppointmentProperties.MappingName
= "Properties"
Me.C1Schedule1.DataStorage.AppointmentStorage.Mapp ings.IdMapping.MappingName
= "ID"
Me.C1Schedule1.DataStorage.AppointmentStorage.Mapp ings.Location.MappingName
= "Location"
Me.C1Schedule1.DataStorage.AppointmentStorage.Mapp ings.Subject.MappingName
= "Subject"
Me.C1Schedule1.DataStorage.AppointmentStorage.Mapp ings.Start.MappingName
= "Start"
Me.C1Schedule1.DataStorage.AppointmentStorage.Mapp ings.Body.MappingName
= "Body"
Me.C1Schedule1.DataStorage.AppointmentStorage.Mapp ings.End.MappingName
= "End"
Me.C1Schedule1.DataStorage.AppointmentStorage.Data Member =
ds.Tables(0).TableName
Me.C1Schedule1.DataStorage.AppointmentStorage.Data Source = ds
End Sub
and here is my C# code:
sql_connection = new SqlConnection("Data
Source=.\\SQLEXPRESS;initial catalog=shefa;integrated security=true");
sql_adapter = new SqlDataAdapter("select * from
dbo.appointments", sql_connection);
data_set = new DataSet();
sql_adapter.Fill(data_set);
binding_source.DataMember = "appointments";
binding_source.DataSource = data_set;
this.c1Schedule1.DataStorage.AppointmentStorage.Ma ppings.AppointmentProperties.MappingName
= "properties";
this.c1Schedule1.DataStorage.AppointmentStorage.Ma ppings.IdMapping.MappingName
= "ID";
this.c1Schedule1.DataStorage.AppointmentStorage.Ma ppings.Location.MappingName
= "location";
this.c1Schedule1.DataStorage.AppointmentStorage.Ma ppings.Subject.MappingName
= "subject";
this.c1Schedule1.DataStorage.AppointmentStorage.Ma ppings.Start.MappingName
= "start";
this.c1Schedule1.DataStorage.AppointmentStorage.Ma ppings.Body.MappingName
= "body";
this.c1Schedule1.DataStorage.AppointmentStorage.Ma ppings.End.MappingName
= "end";
this.c1Schedule1.DataStorage.AppointmentStorage.Da taSource =
data_set;
this.c1Schedule1.DataStorage.AppointmentStorage.Da taMember =
data_set.Tables[0].TableName;