Dim cn As New OleDbConnection
Dim dd1 As New DataSet
Dim dd2 As New DataSet
Dim dd3 As New DataSet
Dim dd4 As New DataSet
Dim ds As New DataSet
C1GanttView1.Tasks.Clear()
Dim cnStr As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\甘特图测试\甘特图数据\C1NWind.mdb;"
cn.ConnectionString = cnStr
cn.Open()
Dim casql As String = " select * from Calendars "
Dim prsql As String = " select * from properties "
Dim resql As String = " select * from resources "
Dim taskssql As String = " select * from tasks "
Dim da1 As OleDbDataAdapter = New OleDbDataAdapter(casql, cn)
Dim da2 As OleDbDataAdapter = New OleDbDataAdapter(prsql, cn)
Dim da3 As OleDbDataAdapter = New OleDbDataAdapter(resql, cn)
Dim da4 As OleDbDataAdapter = New OleDbDataAdapter(taskssql, cn)
da1.Fill(dd1)
da2.Fill(dd2)
da3.Fill(dd3)
da4.Fill(dd4)
cn.Close()
Dim db As New DBDataTable
Dim tb1 As DataTable = dd1.Tables(0)
Dim tb2 As DataTable = dd2.Tables(0)
Dim tb3 As DataTable = dd3.Tables(0)
Dim tb4 As DataTable = dd4.Tables(0)
C1GanttView1.DataStorage.CalendarStorage.DataSource = tb1
C1GanttView1.DataStorage.CalendarStorage.RefreshData()
C1GanttView1.DataStorage.PropertyStorage.DataSource = tb2
C1GanttView1.DataStorage.ResourceStorage.DataSource = tb3
C1GanttView1.DataStorage.ResourceStorage.RefreshData()
C1GanttView1.DataStorage.TasksStorage.DataSource = tb4
C1GanttView1.DataStorage.TasksStorage.RefreshData()
C1GanttView1.DataStorage.CalendarStorage.Mappings.IdMapping.MappingName = "Id"
C1GanttView1.DataStorage.CalendarStorage.Mappings.CalendarID.MappingName = "CalendarID"
C1GanttView1.DataStorage.CalendarStorage.Mappings.Name.MappingName = "Name"
C1GanttView1.DataStorage.CalendarStorage.Mappings.Data.MappingName = "Data"
C1GanttView1.DataStorage.PropertyStorage.Key.MappingName = "Key"
C1GanttView1.DataStorage.PropertyStorage.Value.MappingName = "Value"
C1GanttView1.DataStorage.ResourceStorage.Mappings.IdMapping.MappingName = "Id"
C1GanttView1.DataStorage.ResourceStorage.Mappings.ResourceID.MappingName = "ResourceID"
C1GanttView1.DataStorage.ResourceStorage.Mappings.Name.MappingName = "Name"
C1GanttView1.DataStorage.ResourceStorage.Mappings.Notes.MappingName = "Notes"
C1GanttView1.DataStorage.ResourceStorage.Mappings.ResourceType.MappingName = "ResourceType"
C1GanttView1.DataStorage.ResourceStorage.Mappings.Cost.MappingName = "Cost"
C1GanttView1.DataStorage.ResourceStorage.Mappings.UnitOfMeasure.MappingName = "UnitOfMeasure"
C1GanttView1.DataStorage.TasksStorage.Mappings.IdMapping.MappingName = "Id"
C1GanttView1.DataStorage.TasksStorage.Mappings.Initialized.MappingName = "Initialized"
C1GanttView1.DataStorage.TasksStorage.Mappings.TaskID.MappingName = "TaskID"
C1GanttView1.DataStorage.TasksStorage.Mappings.NextID.MappingName = "NextID"
C1GanttView1.DataStorage.TasksStorage.Mappings.OutlineParentID.MappingName = "OutlineParentID"
C1GanttView1.DataStorage.TasksStorage.Mappings.Summary.MappingName = "Summary"
C1GanttView1.DataStorage.TasksStorage.Mappings.Name.MappingName = "Name"
C1GanttView1.DataStorage.TasksStorage.Mappings.Start.MappingName = "Start"
C1GanttView1.DataStorage.TasksStorage.Mappings.Finish.MappingName = "Finish "
C1GanttView1.DataStorage.TasksStorage.Mappings.Duration.MappingName = "Duration"
C1GanttView1.DataStorage.TasksStorage.Mappings.Mode.MappingName = "Mode"
C1GanttView1.DataStorage.TasksStorage.Mappings.CalendarID.MappingName = "CalendarID"
C1GanttView1.DataStorage.TasksStorage.Mappings.DurationUnits.MappingName = "DurationUnits"
C1GanttView1.DataStorage.TasksStorage.Mappings.PercentComplete.MappingName = "PercentComplete"
C1GanttView1.DataStorage.TasksStorage.Mappings.Deadline.MappingName = "Deadline"
C1GanttView1.DataStorage.TasksStorage.Mappings.ConstraintType.MappingName = "ConstraintType"
C1GanttView1.DataStorage.TasksStorage.Mappings.ConstraintDate.MappingName = "ConstraintDate"
C1GanttView1.DataStorage.TasksStorage.Mappings.HideBar.MappingName = "HideBar"
C1GanttView1.DataStorage.TasksStorage.Mappings.Predecessors.MappingName = "Predecessors"
C1GanttView1.DataStorage.TasksStorage.Mappings.Resources.MappingName = "Resources"
C1GanttView1.DataStorage.TasksStorage.Mappings.CustomFields.MappingName = "CustomFields"
C1GanttView1.DataStorage.TasksStorage.Mappings.Notes.MappingName = "Notes"
这是我的加载数据的代码,麻烦您帮看一下
|