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

The Archive Base Latest Questions

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

I’m trying to convert a DataRow to a DataTable , but I’m getting errors.

  • 0

I’m trying to convert a DataRow to a DataTable, but I’m getting errors. I searched and tried all possible solutions, but none worked!

I have a method which accepts a DataTable as its parameter (this DataTable has one row exactly). That method will return some information.

At first, I tried to convert the DataRow to a DataTable using ImportRow(newtable.ImportRow(row)), but newtable is empty afterward. Then, I tried dt.clone(), but this fills the newtable with just everything, which is not what I was after! Actually the exact thing I was after.

private static void BatchFrontSidePrinting(Student St, frmBaseCard frm)
{
    DBINFOPACK UserInfo;
    DBCARDINFO CardInfo;
    DataTable newtable = new DataTable("newtable");

    foreach (DataRow row in dt.Rows)
    {
        try
        {

            // here, I'm trying to send one DataRow as a DataTable to the GetInfo() method,
            // and for the next iteratio , after getting the info I'm removing the row which was just added,
            // so that for the next iteration, newdatatable is empty.  All of the proceeding actions fail !:( 

            newtable.ImportRow(row); // doesn't work! 

            UserInfo = GetInfo(newtable);

            newtable.Rows.Remove(row); // doesn't work! 

            St = UserInfo.STUDENT;

            ((frmFrontSideCard)frm).Replica = UserInfo.CARDINFO.Replica;

            if (UserInfo.CARDINFO.Replica)
            {
                Loger.Items.Add("Replication !");
            }

            // print
            ((frmFrontSideCard)frm).Print = St;

            // update
            CardInfo = UserInfo.CARDINFO;
            CardInfo.SID = UserInfo.STUDENT.ID;
            CardInfo.BIMAGE = UserInfo.BIMAGE;
            SetInfo(CardInfo);
        }
        catch (Exception exep)
        {
            Loger.Items.Add(String.Format("Inside [BatchFrontSidePrinting()] : Student {0} {1}:", St.ID, exep.Message));
        }
    }
}
  • 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-25T23:13:26+00:00Added an answer on May 25, 2026 at 11:13 pm
    foreach (DataRow row in dt.Rows)
    {
        try
        {
            DataTable newtable = new DataTable();
            newtable = dt.Clone(); // Use Clone method to copy the table structure (Schema).
            newtable.ImportRow(row); // Use the ImportRow method to copy from dt table to its clone.
            UserInfo = GetInfo(newtable);
    
        catch (Exception exep)
        {
            //
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a text area in my form which accepts all possible characters from
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I am trying to render a haml file in a javascript response like so:
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this

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.