老师,在绑定 Gantt 图与 Sql server 表中的表时,此时,后台数据库是用程序带的Sql刚建的,4个表都没有数据。绑定后,在编辑 Gantt 图(输入任务名称)时,报以下错误
If DataTables.Contains("Tasks") = False Then
Dim t As New OuterTableBuilder
t.TableName = "Tasks"
t.C
t.SelectString = "SE LECT * FR OM dbo.Tasks"
t.Build
Else
DataTables("Tasks").Load()
End If
If DataTables.Contains("Resources") = False Then
Dim t As New OuterTableBuilder
t.TableName = "Resources"
t.C
t.SelectString = "SEL ECT * FR OM dbo.Resources"
t.Build
Else
DataTables("Resources").Load()
End If
If DataTables.Contains("Calendars") = False Then
Dim t As New OuterTableBuilder
t.TableName = "Calendars"
t.C
t.SelectString = "SEL ECT * FR OM dbo.Calendars"
t.Build
Else
DataTables("Calendars").Load()
End If
If DataTables.Contains("Properties") = False Then
Dim t As New OuterTableBuilder
t.TableName = "Properties"
t.C
t.SelectString = "SEL ECT * FR OM dbo.Properties"
t.Build
Else
DataTables("Properties").Load()
End If
Dim gv As GanttView = e.Form.Controls("GanttView1").GanttView
gv.PropertyDataTable = DataTables("Properties") '甘特图属性设置存储在Properties表中
gv.CalendarDataTable = DataTables("Calendars") '甘特图的日历设置存储在Calendars表中
gv.ResourceDataTable = DataTables("Resources") '甘特图的资源设置存储在Resources表中
gv.TaskDataTable = DataTables("Tasks") '甘特图的任务数据存储在Tasks表中
gv.LoadSettings() '从数据表中加载设置