Fixing your SQL Injection vulnerabilities will almost certainly fix your error:
Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click
If txtregno.Text = "" Then
MsgBox("Please Enter Registration Id", MsgBoxStyle.Critical, "Registration Id is Required...!!!")
Return
End If
Const query As String = "INSERT INTO registration (RegNo, RegDt, Std, Div, SALUTION, SNAME, Gender, DOB, StdAdd, FatName, FatMobNo, PrvSchName, SchEnterDt, Fees, Status) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
Const query2 As String = "SELECT * FROM Registration WHERE fees = '0' AND std = ?"
Using connection As New OleDbConnection("...")
connection.Open()
Using command As New OleDbCommand(query, connection)
command.Parameters.AddWithValue("@RegNo", txtregno.Text)
command.Parameters.AddWithValue("@RegDt", DTP1.Value)
command.Parameters.AddWithValue("@Std", cmbClass.Text)
command.Parameters.AddWithValue("@Div", cmbDiv.Text)
command.Parameters.AddWithValue("@Salutation", cmbSal.Text)
command.Parameters.AddWithValue("@SName", txtSname.Text)
command.Parameters.AddWithValue("@Gender", gender)
command.Parameters.AddWithValue("@DOB", DOBDTP.Value)
command.Parameters.AddWithValue("@StdAdd", txtadd.Text)
command.Parameters.AddWithValue("@FatName", txtFname.Text)
command.Parameters.AddWithValue("@FatMobNo", txtMobno.Text)
command.Parameters.AddWithValue("@PrvSchName", txtPrvSchName.Text)
command.Parameters.AddWithValue("@SchEnterDt", ADMDTP.Value)
command.Parameters.AddWithValue("@Fees", txtAdmFee.Text)
command.Parameters.AddWithValue("@Status", cmbStatus.Text)
command.ExecuteNonQuery()
MsgBox("Record Saved Successfully.", MsgBoxStyle.Information, "NES Automation...!!!")
End Using
Using command As New OleDbommand(query2, connection)
command.Parameters.AddWithValue("@Std", cmbClass.Text)
Dim da As New DataAdapter(command)
Dim ds As New DataSet()
da.Fill(ds, "Registration")
Grid.DataSource = ds
Grid.DataMember = ds.Tables(0).ToString()
End Using
End Using
End Sub