Dim Current As String
Current = Directory.GetCurrentDirectory()
con.ConnectionString = "PROVIDER = Microsoft.Jet.OLEDB.4.0;Data Source = " & Current & "\SchoolMaticsDatabase.mdb"
con.Open()
TabSelect()
con.Close()
Private Sub TabSelect()
Select Case TabControl1.SelectedIndex
Case Is = 0
TabDay = "Monday"
Case Is = 1
TabDay = "Tuesday"
Case Is = 2
TabDay = "Wednesday"
Case Is = 3
TabDay = "Thursday"
Case Is = 4
TabDay = "Friday"
Case Is = 5
TabDay = "Saturday"
Case Is = 6
TabDay = "Sunday"
End Select
ds.Clear()
sql = "SELECT [Forename],[Surname],[Subject Speciality 1],[Subject Speciality 2],[Subject Speciality 3],[Subject Speciality 4],[Subject Speciality 5],[Subject Speciality 6]," & StartTime & "," & EndTime & ",[Spec1],[Spec2],[Spec3],[Spec4],[Spec5],[Spec6] FROM [Staff] WHERE " & TabDay & " LIKE 'T'"
da = New OleDb.OleDbDataAdapter(sql, con)
da.Fill(ds, "SchoolMaticsDatabase")
End Sub
da.fill(ds,「SchoolMaticsDatabase」)>>>錯誤發生在這行代碼中。VB.NET錯誤:「ConnectionString屬性尚未初始化。」
如果選項卡索引被改變,子選項卡選擇()也被調用。還有一件事是程序檢查星期幾並正確顯示與當天相對應的標籤。星期一這段代碼工作正常,只要星期二發佈了這個錯誤就會出現。
代碼片段無法編譯爲給定。改進它並顯示前6行出現的內部方法。並展示你如何稱此方法。 –
需要更多信息來發布適當的答案 –