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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T23:39:43+00:00 2026-05-13T23:39:43+00:00

I did an importer in VB .Net witch get data from an SQLServer an

  • 0

I did an importer in VB .Net witch get data from an SQLServer an inserts this data throught ADSL connection in a remote MySQL server.

in the first time, it was like 200 records, but now there are more than 500.000 records and it expends like 11hours exporting all the data and that is bad, veryyy bad.

I need to optimize my importer, witch now gets the data into a datatable an them i have a function witch with a loop (row to row) inserts the data with a “insert into” query…
like this:

            For Each dr As DataRow In dt.Rows
            Console.Write(".")

            Dim sql As String = "INSERT INTO clientes(id,nombrefis,nombrecom,direccion,codpos,municipio_id,telefono,fax,cif)" & _
                        "VALUES (@id,@nombrefis,@nombrecom,@direccion,@codpos,@municipio_id,@telefono,@fax,@cif)"
            cmd = New MySqlCommand(sql, cnn)
            cmd.Parameters.AddWithValue("id", Int32.Parse(dr("ID EMPRESA").ToString))
            cmd.Parameters.AddWithValue("nombrefis", dr("NOMEMP"))
            cmd.Parameters.AddWithValue("nombrecom", dr("EMPRESA"))
            cmd.Parameters.AddWithValue("direccion", dr("DIRECC"))
            cmd.Parameters.AddWithValue("codpos", dr("CODPOS"))
            cmd.Parameters.AddWithValue("municipio_id", Int32.Parse(dr("CODIGO MUNICIPIO")).ToString)
            cmd.Parameters.AddWithValue("telefono", dr("TELEF"))
            cmd.Parameters.AddWithValue("fax", dr("FAX"))
            cmd.Parameters.AddWithValue("cif", dr("CIF"))
            cmd.ExecuteNonQuery()
        Next

any ideas or advices?
thanks so much

  • 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-13T23:39:43+00:00Added an answer on May 13, 2026 at 11:39 pm
    1. Create the command, add the parameters and prepare the command (Prepare method) before the loop. Then, in the loop, set the parameter values and execute the command
    2. Execute the commands in transactions, by batches of 1000 or so commands

    EDIT: I just realized you’re using MySQL… So unless you’re using an InnoDB table, you can’t use transactions. Anyway, you can still use my first advice, so that the command is only prepared once

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

Sidebar

Ask A Question

Stats

  • Questions 386k
  • Answers 386k
  • 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 scale_y_log10(breaks = breaks, labels = breaks should do the trick. May 14, 2026 at 11:46 pm
  • Editorial Team
    Editorial Team added an answer There is no such thing as font symmetry? There are… May 14, 2026 at 11:46 pm
  • Editorial Team
    Editorial Team added an answer Use: <xsl:apply-templates select="node"> <xsl:sort select="not(val1 = val2)"/> </xsl:apply-templates> Here is… May 14, 2026 at 11:46 pm

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.