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

  • Home
  • SEARCH
  • 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 6239641
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T11:25:32+00:00 2026-05-24T11:25:32+00:00

I am trying use Thread but i have some problem (I am beginner at

  • 0

I am trying use Thread but i have some problem (I am beginner at the threading)

my codes like that. I have a dataset in form and I want to get some tablequery from DataBase and crete adapter and fiil the dataset in form

Dataset mydataset=new DataSet();
private void Form_Load(object sender,eventargs e)
{
    SqlConnection con=new SqlConnection("constring");
    SqlDataAdapter adap=new SqlDataAdapter("select * from Tables");
    DataTable dt=new DataTable();
    adap.Fill(dt);

    foreach(DataRow dr in dt.Rows)
    {
        ThreadStarter mystarter=delegate{ CreateTable(dr); };
        Thread mythread=new Thread();
        mythread.Start();
    }
}

void CreateTable(DataRow dr)
{
    SqlDataAdapter adap2=new SqlDataAdapter(dr["Query"].toString(),con);
    ada2.Fiil(myDataSet);
}

when I use this code .I get a error like “There is already SqlDataReader for closed first”
What can I do?

  • 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-24T11:25:33+00:00Added an answer on May 24, 2026 at 11:25 am

    I think you’re going to need to explain what you’re trying to do here. It looks like you’re opening a list of tables, and then trying to load all the data from all those tables, in parallel, but all into the same single object… That doesn’t make a lot of sense.

    For what it’s worth, the error seems to be that you’re creating multiple data adapters that are going to use the same database connection at the same time – you can’t do that. If you really wanted to load all this data in parallel, you’d need to make multiple connections to the database.

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

Sidebar

Related Questions

I'm trying to use a Thread in a simple winform. I have a ListBox
I have spent the whole day trying to make my application use threads but
Trying to use a guid as a resource id in a rest url but
While trying to use LINQ to SQL I encountered several problems. I have table
I'm trying to use svnmerge.py to merge some files. Under the hood it uses
I have some Visual C++ code that receives a pointer to a buffer with
I want to use UDP-Sockets for my XNA-Networkgame. And now I am trying to
Here's an interesting problem. I have an ETL script written in c# that I
Trying to use an excpetion class which could provide location reference for XML parsing,
I' trying to use a Linq query to find and set the selected value

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.