riccolmars
Member
- Joined
- Mar 18, 2012
- Messages
- 12
- Programming Experience
- Beginner
Hi,
i have recently started using visual basic, and done very simple things such as create a word/notepad style program and other things. i then decided to make something more complex. Luckily enough, my mother who required something to help assist with her classes and programs she teaches she asked would it be possible to make such a program.
it is going well so far but it pulls up this problem while trying to load the database after i try to filter it.
Here is the code...
Private Sub Year_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles ListYearGroup.SelectedIndexChanged
Dim YearG, SQLString As String
Dim dt As New DataTable()
Dim da As OleDbDataAdapter
Dim ConnectString As String = "Provider = Microsoft.Jet.OLEDB.4.0;" & "Data Source = BlankPupilsdb.mdb"
YearG = YearGroup.Text
SQLString = "SELECT * FROM BlankPupilsdb WHERE YearGroup = " & " ' " & YearG & " ' " & " "
da = New OleDbDataAdapter(SQLString, ConnectString)
da.Fill(dt) <------------------------------------------------- Here is where the problem occurs
DataGrid1.DataSource = dt
End Sub
in the form, which is called LessonForm there is :-
That is all the information i think i have to help solve the problem, knowing me it will be something very simple and all the info was not needed but better be safe. would it also be possible to ask not only for help to the problem but like reasoning why it happened and how and why the solution happens.
Hope someone could help, Thanks.
i have recently started using visual basic, and done very simple things such as create a word/notepad style program and other things. i then decided to make something more complex. Luckily enough, my mother who required something to help assist with her classes and programs she teaches she asked would it be possible to make such a program.
it is going well so far but it pulls up this problem while trying to load the database after i try to filter it.
Here is the code...
Private Sub Year_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles ListYearGroup.SelectedIndexChanged
Dim YearG, SQLString As String
Dim dt As New DataTable()
Dim da As OleDbDataAdapter
Dim ConnectString As String = "Provider = Microsoft.Jet.OLEDB.4.0;" & "Data Source = BlankPupilsdb.mdb"
YearG = YearGroup.Text
SQLString = "SELECT * FROM BlankPupilsdb WHERE YearGroup = " & " ' " & YearG & " ' " & " "
da = New OleDbDataAdapter(SQLString, ConnectString)
da.Fill(dt) <------------------------------------------------- Here is where the problem occurs
DataGrid1.DataSource = dt
End Sub
in the form, which is called LessonForm there is :-
- Data Grid called DataGrid1
- label named YearGroup and the text inside is "Year Group
- List Box called ListYearGroup with "7,8,9,10,11" Inside
- BlankPupilsDataSet
- BlankPupilsDataSetBindingSource
- BlankPupilsDbTableAdapter
That is all the information i think i have to help solve the problem, knowing me it will be something very simple and all the info was not needed but better be safe. would it also be possible to ask not only for help to the problem but like reasoning why it happened and how and why the solution happens.
Hope someone could help, Thanks.