Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


using C# How to open an MS Access database and  import the data into a gridview

Posted on 2014-01-14
Medium Priority
Last Modified: 2014-01-16
Can I get data from an Access Database and import that data into an ASP.NET gridview?
If so, please provide a detialed C#/ code example.
Question by:newjeep19
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2

Accepted Solution

fredvr666 earned 2000 total points
ID: 39780220
Like this:
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.OleDb;
using System.Data;
namespace WebApplication2
    public partial class WebForm1 : System.Web.UI.Page
        protected void Page_Load(object sender, EventArgs e)
    private void OpenAccessTables()
        //"Jet OLEDB:Database Password=;" +
        string AccessConnString = "Provider=Microsoft.Jet.OLEDB.4.0;" +
                                         "Data Source=C:\\test.mdb; " +
                                         ";Persist Security Info=False";
        OleDbConnection conAccess = new OleDbConnection();
        conAccess.ConnectionString = AccessConnString;
        //open the connection to the Access database
        OleDbCommand cmd = new OleDbCommand("SELECT * FROM tbluren", conAccess);
        cmd.CommandType = CommandType.Text;
        OleDbDataAdapter data = new OleDbDataAdapter(cmd);
        DataTable uren = new DataTable();
        this.GridView1.DataSource = uren;


Author Comment

ID: 39780815
Thank you for the example....I am using file upload and getting th path to the access db then I need to open that data from the access db in an gridview table. From the gridview table I need to then update the data to a SQL db table.

Expert Comment

ID: 39781607
newjeep this is a new question :-)

Author Comment

ID: 39786165
OK I will close the request then

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question