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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T17:51:57+00:00 2026-06-04T17:51:57+00:00

Context My appliction uses an SQL database from which it reads my datatables at

  • 0

Context

My appliction uses an SQL database from which it reads my datatables at start of my application. If the application would fail to connect to the SQL DB, I have a local Ms Access .MDB file. I have a separate thread that checks if the local database is outdated.

I have a DataTable which I obtain from my SQL connection –> Verified and working
I can connect to my Access database locally and read from it –> Verified and working

Issue/Question

I’m trying to update my local database by updating it with the DataTable I obtained from my SQL Connection.

public static void UpdateLocalDatabase(string strTableName, OleDbConnection MyConnection, DataTable MyTable)
{
    try
    {
        if (CreateDatabaseConnection() != null)
        {
            string strQuery = "SELECT * FROM " + strTableName;
            OleDbDataAdapter MyAdapter = new OleDbDataAdapter();
            OleDbCommandBuilder MyCommandBuilder = new OleDbCommandBuilder(MyAdapter);
            MyAdapter.SelectCommand = new OleDbCommand(strQuery, odcConnection);
            MyAdapter.UpdateCommand = MyCommandBuilder.GetUpdateCommand();
            MyConn.Open();
            MyAdapter.Update(MyTable);
            MyConn.Close();
        }
    }
    catch { }
}

If I debug this snippet, all variables are what they should be:

  • strTableName = the correct name for my table
  • MyConn = @”Provider=Microsoft.Jet.OLEDB.4.0;Data Source=MyLocation;Persist Security Info=True;JET OLEDB:Database Password=MyPassword;”
  • MyTable = is the correct table that is also used further on by my application

This process runs through without an error and without using the catch but it does not touch my database, it just doesn’t do a thing.

Am I dropping the ball here or just missing the obvious, I have no idea but I browsed many articles and apart for showing the MyAdapter.Update(), there doesn’t seem to be much more to it.

Any help is welcome.

Thanks,

Kevin

  • 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-06-04T17:51:58+00:00Added an answer on June 4, 2026 at 5:51 pm

    Does your backup database have to be in access? because if you used SQL Compact Edition it’d be much easier to copy between the two?

    Yes, it would either mean attaching it with your installer or just ensuring that all client machines have it pre-installed, it is free however.

    if this is an issue then all you need to do (I think, not done it myself)
    would be to go to your installer projects properties, click prerequisites and then tick SQL compact so that it will be installed before your application can be used, iv done this before with other frameworks and it just pops up a box with the install shield asking whether they want to download the necessary software and its just one click then it should be done for them.

    Do you need a hand on using the compact database also?

    One negative by the way is it does lack some higher end features but shouldn’t affect average database work

    EDIT

    if you will be using sql CE you can easily make the databse in VS by clicking data and new data source then following the steps making sure to put sql CE when asked

    if it works, you’ll end up with an .sdf database

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

Sidebar

Related Questions

I have an application which uses a SQL database. This is encapsulated by a
I'm working on an application which uses SQLite Database on Android.I have a custom
I have an application which uses context sensitive datasources. Currently I keep the datasource
Context In our application, we snapshot data from a database using a query that
I have a multi module maven web application, which uses hibernate. I use the
I've got a hibernate-based application which uses DBUnit for unit testing. We have an
I develop desktop-based WPF-application, that uses SQL Server 2008 R2 Database and ADO.NET Entity
Background/context for this question: I have a WPF desktop application. It uses LINQ to
I have a web application which uses jQuery UI. The JavaScripts are not downloaded
I have an application which uses version 8.0.50727.5592 of the CRT. One of the

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.