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

  • Home
  • SEARCH
  • 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 6889843
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:12:25+00:00 2026-05-27T06:12:25+00:00

I am getting an error while i am trying to insert a user id

  • 0

I am getting an error while i am trying to insert a user id of my client in the ms access database.

The error i am getting is Overflow.

when i am trying to insert its getting the above error.

I am using these code.

        OleDbCommand cmd = new OleDbCommand("insert into UserInfo " + "([firstname], [lastname], [gender], [occupation], [expirydate], [UserId], [phoneno]) " + " values('" + txt_FirstName.Text + "','" + txt_LastName.Text + "','" + cmb_Gender.Text + "','" + cmb_Occupation.Text + "','" + txt_expiryDate.Text + "','" + txt_HardDiskId.Text + "','" + txt_PhoneNo.Text +  "');", con);
        OleDbCommand cmd1 = new OleDbCommand("select * from UserInfo where (HardDiskId='" + txt_HardDiskId.Text + "')", con);
        int temp = 0;
        try
        {
            con.Open();
            string count = (string)cmd1.ExecuteScalar();
            if ((count == "") || (count == null))
            {
                temp = cmd.ExecuteNonQuery();
                if (temp > 0)
                {
                    MessageBox.Show("User ID of " + txt_FirstName.Text + " " + txt_LastName.Text + " has been added");
                }
                else
                {
                    MessageBox.Show("Record not added");
                }
            }
            else
            {
                MessageBox.Show("User ID of " + txt_FirstName.Text + " already exists. Try another user ID.");
            }
        }
  • 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-27T06:12:26+00:00Added an answer on May 27, 2026 at 6:12 am

    Aside from being open to SQL Injection (which you should parameterize your OleDbCommand), first thought on a problem is what you are trying to store the data. Do any of the text fields have special characters or apostrophe in name which would otherwise pre-terminate your embedded …. ‘” + nextField + “‘ …” entries and throw the balance off.

    Another… don’t know if the parser is picky or not… but a space after values, before open paren…. ” values(” to ” values (“.

    Third, and more probable the issue is the expiration date. If its a date field, and you are trying to put in as text, it might be failing on the data type conversion.

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

Sidebar

Related Questions

I am getting an error while trying to insert an item into my database.
I am getting an error while trying to run CFmx code on a remote
I keep getting this error while trying to modify some tables. Here's my code:
I'm trying to compile some code. Here is the error I'm getting: error while
Am getting this compiler error while trying to compile an VS 6 VC++ code.
im getting this error while trying to connect a mysql database to an editor,
I'm getting error Not unique table/alias while trying to display data from MySQL database
I´m getting this error while trying to commit to a svn repository: svn: MKACTIVITY
I'm getting an error while trying to use the action_mailer_tls plugin to communicate with
All of a sudden I start getting this error while trying to open 2

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.