title: ASP.NET - MS-ACCESS - VB.NET - SQL STATEMENT ERROR
body: <p>Can anyone tell me what's wrong with this code? It's giving me an error in <code>cmd.ExecuteNonQuery()</code></p>
  
  <pre><code>Protected Sub btnCreateAccount_Click(sender As Object, e As System.EventArgs) Handles btnCreateAccount.Click
  
      Dim conn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Users\Brian\Documents\Visual Studio 2010\WebSites\WebSite3\db.mdb;")
  
      Dim cmd As OleDbCommand = New OleDbCommand("INSERT INTO [User] (CustomerName, CustomerSurname, Address, Country, TelNo, Username, Password, UserTypeID) VALUES (?, ?, ?, ?, ?, ?, ?, ?)", conn)
  
  
  
  
      If txtPass.Text = txtCPass.Text Then
  
          conn.Open()
  
  
          cmd.Parameters.Add("@CustomerName", OleDbType.VarChar, 255).Value = txtName.Text
          cmd.Parameters.Add("@CustomerSurname", OleDbType.VarChar, 255).Value = txtSurname.Text
          cmd.Parameters.Add("@Address", OleDbType.VarChar, 255).Value = txtAddress.Text
          cmd.Parameters.Add("@Country", OleDbType.VarChar, 255).Value = txtCountry.Text
          cmd.Parameters.Add("@TelNo", OleDbType.Integer).Value = txtTelNo.Text
          cmd.Parameters.Add("@Username", OleDbType.VarChar, 255).Value = txtUsername.Text
          cmd.Parameters.Add("@Password", OleDbType.VarChar, 255).Value = txtPass.Text
          cmd.Parameters.Add("@UserTypeID", OleDbType.Integer, 255).Value = "1"
  
  
  
  
  
          cmd.ExecuteNonQuery()
  
          conn.Close()
          lblAccount.Visible = True
  
  
  
      End If
  
  End Sub
  </code></pre>
  
  <p>End Class</p>