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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:38:30+00:00 2026-06-15T21:38:30+00:00

I have a very long winded question. I have recently been given a task

  • 0

I have a very long winded question. I have recently been given a task by my employer where I am to create a custom DBF to SQL migration utility in C# from 117 *.dbf files. Each table has approximately 40-50 columns and over 100 rows. (Eg. Property Management Database)

How I am tackling it is the following:

  1. Convert a dbf file into a DataTable object.
  2. Add the DataTable object to a List<DataTable> which is contained in the model object.
  3. Bind list to a DataGridView for column viewing purposes.

This is all done in a background worker which works fine.

The next thing I need to do is allow the user to convert and save this list into a very large *.sql file (or optionally, migrate it directly to SQL Express). Again, this I attempt to do in a background thread.

This is where I run into problems. I have a method that accepts a DataTable object and returns a string. In it, I have a stringbuilder object which concatenates all the columns into a ‘create table’ statement and attaches the associated insert statements in order to include the data.

This method is executed in a loop while passing an instance of each DataTable from List<DataTable> stored in the model object.

Now this works fine up until about the fourth or fifth DataTable before an ‘Out of Memory’ exception is thrown. I am sure to initiate and dispose of any objects I am not using. I have even went as far as to change all my string concatenation to stringbuilder append logic to take advantage of the stringbuilders better memory management.

I am pretty sure that all my objects are deallocated and garbage collected, so I am assuming that the problem lies in the fact that I am storing all the 117 tables in a list of the model object. Whenever I need to access this list, I simply pass a reference to the model object. As soon as I start building an sql statement for all the tables, the combination between the DataTables list and the Stringbuilder object, it’s running out of memory.

I neglect to inform that I am new to the industry as I am fresh out of college. I have been programming for many years only until recently have I been following ‘best practice’. So my question is to all of you, am I tackling this project the wrong way? Is there a better way to do it and if so, could you help shed some light as to what you would do in my place?

  • 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-15T21:38:31+00:00Added an answer on June 15, 2026 at 9:38 pm

    Alright, I did what made sense. I simply wrote the SQL directly to file rather than write it to a string and then write that string to file. This appears to have done the trick. Not sure why I didn’t think of it earlier.

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

Sidebar

Related Questions

This question is long winded because I have been updating the question over a
(This is sort of a long-winded question but I have summarized it at the
I currently have some VERY long winded code for the menu I use on
I have a very long-running stored procedure in SQL Server 2005 that I'm trying
I have very long integer sequences that look like this (arbitrary length!): 0000000001110002220033333 Now
I have a very long javascript (so long that it's too long to escape
We have a very long form that has a number of fields and 2
I have a very long String and I want to read character by character
I have a very long table in my webpage. When I print it, it
I have a very long text and I need to hide everything except 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.