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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:53:59+00:00 2026-05-27T07:53:59+00:00

I am currently working on a patching system in C# and I have came

  • 0

I am currently working on a patching system in C# and I have came across a small complication. I am using MySQL to store an archive for my update list. The patching system then detects the version of program, and downloads every patch after that version. Though I just started learning how to use MySQL in C# so i’m not sure how to do, or call a lot of the functions needed. What I want to do is use foreach to call all values in the “version” column/row, then use a while loop to check against current version and new version until they are the same. I just cant seem to figure out how to use the two together and can’t find any references.

using (SqlCon = new MySqlConnection(connString))
{
    SqlCon.Open();
    string command = "SELECT * FROM version ORDER BY version";
    MySqlCommand GetLatestVersion = new MySqlCommand(command, SqlCon);

    using (MySqlDataReader DR = GetLatestVersion.ExecuteReader())
    {
        while (DR.Read())
        {
            foreach(DataTable i in DR)
            {
                while(v1 < v2)
                {
                    string LatestVersion = Convert.ToString(DR.GetValue(1));
                    string WebURL = Convert.ToString(DR.GetValue(2));
                    update.DownloadProgressChanged += new DownloadProgressChangedEventHandler(download);
                    update.DownloadFileCompleted += new AsyncCompletedEventHandler(extration);
                    update.DownloadFileAsync(new Uri(WebURL), tempFilePath + "patch" + Latest_Version + ".zip");
                }
            }
        }
    }
}
SqlCon.Close();

I would greatly appreciate any help.

  • 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-27T07:53:59+00:00Added an answer on May 27, 2026 at 7:53 am

    First thing is you don’t need the SqlCon.Close(); at the end. At the end of the using block, the object is disposed of (the point of a using block).

    You can modify your select statement to only select versions greater than your program’s current version. This way, any records selected should be processed/downloaded. (I put the version in quotes in the SQL statement below because your code indicates that it’s a string. You’re probably better off specifying this value as numeric for sorting/comparison purposes, though.)

    //for readability, I changed the variable name to myProgramsVersion
    
    using (SqlCon = new MySqlConnection(connString))
    {
        SqlCon.Open();
        string command = "SELECT * FROM version where version > '" + myProgramsVersion + "' ORDER BY version";
        MySqlCommand GetLatestVersion = new MySqlCommand(command, SqlCon);
    
        using (MySqlDataReader DR = GetLatestVersion.ExecuteReader())
        {
            while (DR.Read())
            {
                string LatestVersion = Convert.ToString(DR.GetValue(1));
                string WebURL = Convert.ToString(DR.GetValue(2));
                update.DownloadProgressChanged += new DownloadProgressChangedEventHandler(download);
                update.DownloadFileCompleted += new AsyncCompletedEventHandler(extration);
                update.DownloadFileAsync(new Uri(WebURL), tempFilePath + "patch" + Latest_Version + ".zip");
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Currently working on a 3D media engine using C# and I have come across
I am working on a patching system and I have one last bug i
Currently working on a bespoke ecommerce application using Codeigniter. I have a products table
I`m currently working on a script, and I have the following situation. function somnicefunction()
I'm currently working on a consumer mobile application project and have read that 40%
Im currently working on a custom product list in the Magento backend. Heres the
im currently working in a simple program that implements plugins whith dll libraries (using
Currently working on trying to figure out asynchronous submission in ColdFusion. I always have
im currently working on a classification task using language modelling. The first part of
Currently working on a game, and is converting it to retina. I am using

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.