title: How to Update my Access Database from textboxes
body: <p>i created a screen where i can edit the details in the database. but as soon as i click on the update button, it says no value given for one or more required parameters. i have attached my code....</p>
  
  <p>Update BUtton...</p>
  
  <pre><code>Private Sub SimpleButton5_Click(sender As Object, e As EventArgs) Handles SimpleButton5.Click
  
      Try
  
          Access.AddParam("@UId", TextBox1.Text)
          Access.AddParam("@ImagePic", PictureBox1.Image)
          Access.AddParam("@Barcod", TextBox2.Text)
          Access.AddParam("@BrandName", TextBox3.Text)
          Access.AddParam("@StockName", TextBox4.Text)
          Access.AddParam("@Category", TextBox5.Text)
          Access.AddParam("@SubCat", TextBox6.Text)
          Access.AddParam("@Subcat2", TextBox7.Text)
          Access.AddParam("@Discrip", TextBox8.Text)
          Access.AddParam("@StockLvl", TextBox9.Text)
          Access.AddParam("@CustomAmount", TextBox10.Text)
          Access.AddParam("@CostPrice", TextBox11.Text)
          Access.AddParam("@Markup", TextBox12.Text)
          Access.AddParam("@TaxAmount", TextBox13.Text)
          Access.AddParam("@SellingPrice", TextBox14.Text)
          Access.AddParam("@BeforTax", TextBox15.Text)
          Access.AddParam("@AfterTax", TextBox16.Text)
          Access.AddParam("@TaxPer", TextBox17.Text)
          Access.AddParam("@MarkupPer", TextBox18.Text)
          Access.AddParam("@LastDate", TextBox19.Text)
          Access.AddParam("@LastUser", TextBox20.Text)
  
          Access.ExecQuery("UPDATE Inventory " &amp;
                           "SET [Image]=PictureBox1.image, BarCode=Textbox2.text, " &amp;
                           "BrandName=@BrandName, StockName=@StockName, Category=@Category, SubCategory=@SubCat, " &amp;
                           "SubCategory2=@SubCat2, Description=@Discrip, StockLevels=@StockLvl, CustomAmount=@Customamount, " &amp;
                           "CostPrice=@CostPrice, MarkupAmount=@Markup, SellingPrice=@SellingPrice, ProfirBefore=@BeforeTax, " &amp;
                           "ProfitAfter=@AfterTax, TaxAmount=@TaxAmount, taxPer=@TaxPer, MarkupPer=@MarkupPer, LastDateupdated=@LAstDate, " &amp;
                           "UpserUpdated=@LastUser WHERE ID=@UId")
  
          If NoErrors(True) = False Then Exit Sub
  
          RefreshData()
  
      Catch ex As Exception
          MsgBox(ex.Message)
      Finally
  
      End Try
  
  End Sub
  </code></pre>
  
  <p>My Access.ExecQuery --- (Class...)</p>
  
  <pre><code>Imports System.Data.OleDb
  
  Public Class DBControl
      Private DBCon As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=Database1.accdb;")
      Private DBCmd As OleDbCommand
      Public DBDA As OleDbDataAdapter
      Public DBDT As DataTable
      Public Params As New List(Of OleDbParameter)
      Public RecordCount As Integer
      Public Exception As String
  
      Public Sub ExecQuery(Query As String)
          RecordCount = 0
          Exception = ""
  
          Try
              DBCon.Open()
              DBCmd = New OleDbCommand(Query, DBCon)
  
              Params.ForEach(Sub(p) DBCmd.Parameters.Add(p))
  
              Params.Clear()
  
              DBDT = New DataTable
              DBDA = New OleDbDataAdapter(DBCmd)
              RecordCount = DBDA.Fill(DBDT)
          Catch ex As Exception
              Exception = ex.Message
          End Try
  
          If DBCon.State = ConnectionState.Open Then DBCon.Close()
      End Sub
  
      ' INCLUDE QUERY &amp; COMMAND PARAMETERS
      Public Sub AddParam(Name As String, Value As Object)
          Dim NewParam As New OleDbParameter(Name, Value)
          Params.Add(NewParam)
      End Sub
  End Class
  </code></pre>
  
  <p>I have played around with this for 2 days now, but somewhere i am missing something or overlooking something</p>
  
  <p>thx</p>
  
  <p>Jaco</p>