Imports System.Data.OleDb
Public Class Form3
Dim cmd As New OleDbCommand
Dim rdr As OleDbDataReader
Dim strmsg As String
Dim db As New mydb1
Dim da As New OleDbDataAdapter
Dim dset As New DataSet
Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
db.dbconnection()
strmsg = "select Class from Week"
cmd = db.dbcommand(strmsg)
rdr = cmd.ExecuteReader
'While rdr.Read
'ComClass1.Items.Add(rdr.Item("class"))
'End While
rdr.Close()
EndSub
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
cmd.CommandText = "select * from Week where Nme = '"& ComboBox1.Text.ToString &"' "
rdr = cmd.ExecuteReader
rdr.Read()
txtClass.Text = rdr.Item("Class")
rdr.Close()
EndSub
Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
cmd = db.dbcommand("insert into Week(Nme,Score,Class) values(Default,'"& Val(txtScore.Text) &"',Default ) where Nme = '"& ComboBox1.Text.ToString &"'")
cmd.ExecuteNonQuery()
Me.Hide()
'cmd.Dispose()
EndSub
EndClass
following are the screenshots of error and my table