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 129231
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T05:45:33+00:00 2026-05-11T05:45:33+00:00

I need to insert new records into an Access database. I’m using Visual Studio

  • 0

I need to insert new records into an Access database.
I’m using Visual Studio 2008 and firstly create a asp.net website. I can connect to the information in Access databse using dataview or gridview and can query a particular entry (ie. Proposal No. -brings up all details linking to that proposal).
I can then edit the details of that proposal and this would update the Access Db.
What I need to do is to have a form that simply enters new details for a new customer. ie. Enter name [____] Enter Adress[____]. Then for this to update the database. By using the gridview or dataview I am able to view all fields that exist in the table and edit them. Is there a way that I can get a blank gridview/dataview template (which includes all the fields in the table) and fill it out to then update the database? Thanks

  • 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. 2026-05-11T05:45:33+00:00Added an answer on May 11, 2026 at 5:45 am

    The usual way of allowing the end user to add a new record to a database is through presenting the user with a set of controls to fill in and/or select from i.e. a number of labelled textbox, listbox, checkbox, etc. controls.

    How these are laid out is up to you, and you could lay them out to mimic your gridview. I would recommend creating a user control and then using that in your page.

    EDIT:

    To answer your comment about how to add the fields as a record to the database, you would do something like the following (this is in C#)

    Firstly, set up add a connection string to the connectionstrings section in your web.config. It is generally good practice to set them up here if you’re going to be using the same data source throughout your application, as it saves you from having to write the connection string out each time

    <connectionStrings>  <add name='myConnectionString' connectionString='Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|db1.mdb' providerName='System.Data.OleDb' /> </connectionStrings> 

    Then in the code-behind for your page

        protected void AddButton_Click(object sender, EventArgs e)     {         AddRecordToDatabase(txtCustomerName.Text, txtPlaceOfBirth.Text);           /*           Where txtCustomerName and txtPlaceOfBirth are the IDs            of your Name and Place Of Birth textboxes, respectively.           You may want to perform some validation on the textboxes before           performing the insert!         */     }      private void AddRecordToDatabase(string customerName, string placeOfBirth)     {         OleDbConnection conn;         OleDbCommand cmd;          using (conn = new OleDbConnection(ConfigurationManager.ConnectionStrings['myConnectionString'].ConnectionString))         {             using (cmd = conn.CreateCommand())             {                 cmd.CommandText = 'INSERT INTO Customers(Name, PlaceOfBirth) VALUES (@name, @place_of_birth)';                 cmd.CommandType = CommandType.Text;                  cmd.Parameters.AddWithValue('@name', customerName);                 cmd.Parameters.AddWithValue('@place_of_birth', placeOfBirth);                  conn.Open();                 cmd.ExecuteNonQuery();             }         }     } 

    The using statements will dispose of the objects once finished with (they are essentially Try-Finally blocks).

    Depending on the version of Access, it may be possible to return a value after the insert to indicate whether the insert has succeeded or not (I’m only familiar with Access 97 – 2003). If this is possible, you may want to use ExecuteScalar instead of ExecuteNonQuery to obtain the return value and respond accordingly.

    As a very general piece of advice, I would not recommend Jet (the database engine that Access uses) as the backend database for an ASP.NET website- have a look at the answers to this question for reasons why. SQL Server 2005 Express is free to use* and is an excellent database choice for web development.

    *There are some limitations, check Microsoft Website for details.

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

Sidebar

Ask A Question

Stats

  • Questions 114k
  • Answers 114k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Over the wire, ADO.NET data services and RIA services are… May 11, 2026 at 10:12 pm
  • Editorial Team
    Editorial Team added an answer Do you still get the exception when you run CruiseControl.Net… May 11, 2026 at 10:12 pm
  • Editorial Team
    Editorial Team added an answer You can mark these dependencies as provided: <dependency> <groupId>xerces</groupId> <artifactId>xerces</artifactId>… May 11, 2026 at 10:12 pm

Related Questions

I need to insert new records into an Access database. I'm using Visual Studio
I have a table that has about 1/2 million records in it. Each month
I have been tasked with developing a solution that tracks changes to a database.
The issue is there is a database with around 20k customer records and I
Basically I need to insert a bunch of data to an Excel file. Creating

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.