Greetings all, I am a beginner for Thus, I have a problem regarding the code below;

Private Sub btnSaveUpdates_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSaveUpdates.Click

Dim changes As Integer
Dim strYear As String

Dim dataAdapter As New OleDb.OleDbDataAdapter(sqlStr, connStr)
Dim commandBuilder As New OleDb.OleDbCommandBuilder(dataAdapter)

strYear = cboYear.Text

changes = dataAdapter.Update(dt) <-----error here

If cboYear.Text = "2004" Then
MsgBox("No record stored.", MsgBoxStyle.Critical)
dgvDisplayDemand.DataSource = ""
ElseIf cboYear.Text = "2009" Then
If changes > 0 Then
MessageBox.Show("No changed")
End If
End If
End Sub

As the results, it was an error .

OleDbException was unhandled, "No value given for one or more required parameters".

Anyone,kindly please help me. I am stuck.Thanks in advance.

Welcome Faiz Azani.
Error message says that your query missing columns of your table. i.e. query has invalid column name.

Read following rule:
1.Homework policy
2.How to post source code?
3.Title of thread must reflect your question.

Source code must be surrounded with code tags.
For example,

[] ... statements..


This article has been dead for over six months. Start a new discussion instead.