Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7701205
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T22:55:44+00:00 2026-05-31T22:55:44+00:00

Using VB.NET with ASP.NET and and ms-access 2003 data, I’m trying to input data

  • 0

Using VB.NET with ASP.NET and and ms-access 2003 data, I’m trying to input data from a web form to the a table in db.mdb called ‘USER’.

I tried this 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;User Id=admin;Password=;")

    Dim cmd As OleDbCommand = New OleDbCommand("INSERT INTO USER (Name, Surname, Username, Country, TelNo, Password, Address) VALUES (?, ?, ?, ?, ?, ?, ?)", conn)

    If txtPass.Text = txtCPass.Text Then

        cmd.Parameters.Add("@Name", OleDbType.VarChar, 255).Value = txtName.Text
        cmd.Parameters.Add("@Surame", 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("@Username", OleDbType.VarChar, 255).Value = txtUsername.Text
        cmd.Parameters.Add("@Password", OleDbType.VarChar, 255).Value = txtPass.Text
        cmd.Parameters.Add("@TelNo", OleDbType.Integer).Value = txtTelNo.Text

        Try

            conn.Open()
            cmd.ExecuteNonQuery()
            conn.Close()

        Catch ex As OdbcException
            Throw ex
        Finally
            conn.Close()
            lblAccount.Visible = True


        End Try

    End If

End Sub

But it’s returning me an error message:

enter image description here

Any suggestions to why the problem might be cause?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T22:55:46+00:00Added an answer on May 31, 2026 at 10:55 pm

    User and Password are reserved keywords. Change the names, or use square brackets around the names in the query:

        Dim cmd As OleDbCommand = New OleDbCommand("INSERT INTO [USER] (Name, Surname, Username, Country, TelNo, [Password], Address) VALUES (?, ?, ?, ?, ?, ?, ?)", conn)
    

    Then, for then next error that you will encounter: As the parameters are not named in the query, the parameter objects in the Parameters collection has to be added in the same order as they are used in the query.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a website built using Asp.net and LinqToSql for Data Access. In a
How can I access UserId in ASP.NET Membership without using Membership.GetUser(username) in ASP.NET Web
I am using NHibernate to as the Data Access layer for my ASP.NET MVC
I have a process in a website (Asp.net 3.5 using Linq-to-Sql for data access)
I have a ASP.Net page using ADO to query MS access database and as
I have an ASP.Net application where I am using Windows authentication to deny access
I am using a global named mutex for file access synchronization between an ASP.NET
I maintain a legacy ASP.Net Web application (using .Net 2.0 + SQL Server 2005
I am using ASP.NET to open an Excel 2003 document hosted on the server.
I am having log4net permission issue from ASP.Net 4.0 web application to write to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.