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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T21:46:28+00:00 2026-06-11T21:46:28+00:00

I have the following c# code to filter at present data while connecting to

  • 0

I have the following c# code to filter at present data while connecting to multiple MS access database Tables. This works fine but as the Dataset ds is too huge for loop takes forever to return checking each row calling another mdb database table. Is there a way to optimize this to delete the rows based on the column filters.

string ABCACCESSDataSource = @"c:\websites\abc.mdb";
string XYZACCESSDataSource = @"c:\websites\xyz.mdb";

private void dataviewTable()
{
        OleDbConnection Conn = DatabaseCommands.openDBConnection(ABCACCESSDataSource, this);
        string query1 = select column1, column2, column3 from ABCTable where column2 = 'hello' order by column1;
        Dataview dv; 
        OleDbDataAdapter da = new OleDbDataAdapter(query1, Conn);

        DataSet ds = new System.Data.DataSet();
        da.Fill(ds, "ABCTable");

         foreach (DataRow dr in ds.Tables["ABCTable"].Rows)
          checkValue = dr["ABCTable"].ToString();
                        {
                        resultvalue = getvalue(checkValue);
                        if(resultvalue == "unavailable")
                        {
                            dr.delete();
                        }

             dv = ds.Tables["ABCTable"].DefaultView;    
}    

private string getvalue(string checkValuepassed)    
{
        OleDbConnection Conn2 = DatabaseCommands.openDBConnection(XYZACCESSDataSource, this);
        string query2 = select columnX from XYZTable where columnY = 'test' AND columnZ = '" + checkValuepassed +"'" ;;

        OleDbDataAdapter da2 = new OleDbDataAdapter(query2, Conn2);
        ds2 = new DataSet();
                        da2.Fill(ds2);
                        resultVal = ds2.Tables[0].Rows[0][0].ToString() ;

                        return resultVal;
}
  • 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-11T21:46:30+00:00Added an answer on June 11, 2026 at 9:46 pm

    If you are getting a single value then putting it in Table to retrieve the values is slow.

    But retrieve the values once.

    string query2 = select columnZ, columnX from XYZTable where columnY = 'test' ;;
    
    Dictionary<string, string> table2Dict = new Dictionary<string, string>();
    
    table2Dict.add(columnZ, columnX);
    
    colZvalue = table2Dict[checkValuepassed];
    

    Another way to look at this is not loop the ABC.
    Just loop XYZ and issue delete commands to ABC.
    If the record is not there it will delete nothing.
    And batch up in groups of like 10-100.
    There will be sweet spot.
    Delete [XYX] where [ABCTable] in (..,..,..);

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

Sidebar

Related Questions

I have following code for inserting data into database using PDO. It inserts data
I have the following (sample)code to filter search results from a LLBLGen data source:
I have the following code to filter a grid from values inputed in a
I have the following code in my index view. latest_entry_list = Entry.objects.filter(is_published=True).order_by('-date_published')[:10] for entry
i have the following code in an asp.net mvc view. <% = Html.DropDownList(Filter, new
Helo, i have the following code which should filter entities. Half of the code
I have the following code, using Django ORM routes =Routes.objects.filter(scheduleid=schedule.id).only('externalid') t_list = [(route.externalid, route.vehicle.name)
Hi I have this following code with jquery , so it will alternate colors
I have following code: hotels = models.Hotel.objects.filter( wed=True, county=hotel_main.county.id, subscriptions__end_date__gte=datetime.date.today(), subscriptions__enquiry_count__lte=F('subscriptions__tier__enquiry_limit'), ).filter(Q(x=TRUE|Q(y=True)).distinct() And i
I have the following code: $(#Table1 tbody).children().each(function(e){ $(this).bind('click', function(){ // Do something here },

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.