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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T16:47:49+00:00 2026-06-06T16:47:49+00:00

I have this datatable, actually a list of datatable List<DataTable> lstDataSource , now for

  • 0

I have this datatable, actually a list of datatable
List<DataTable> lstDataSource, now for each table in the list I know there are exactly 6 rows, (monday to saturday!), but there can be any number of columns (well from 6 to 14 that is, the number of hours an employee is working per day!)
So I know the limits of both rows and columns in each datatable. My point is how do I use this list of datatable to update (rather insert) all these values in read database table EmpWorkSchedule.
What I know is total rows inserted would be lstDataSource.Count * 6 right? Also, for any column that doesn’t have values, (some employee work 6 hrs, some 7 hrs etc… ) other columns in that rows would be just set to null. (They are defined as nullable in database). I hope I madeself clear. So, how can I do this?
Also, if there’s anything unclear, please feel free to ask.

EDIT : I have this list of DataTable List<DataTable> lstDataTable, what I want is to insert all rows from each of these tables in the list, to a database table named EmpWorkSchedule, all the values in each row are sequential, that is first column corresponds to column 1 in database table, and so on, okay? But now all rows have values for all column, some have 6, some 7, some 8.. What I want is that for the columns, for which, there is no value in the datarow, should be left null in the database table, rest all values should be inserted.

Also, using an adapted doesn’t seems likely because its used with select, I am not selecting anything, I am inserting something.

  • 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-06T16:47:50+00:00Added an answer on June 6, 2026 at 4:47 pm

    Maybe you just need to Loop on your DataTable and save each row records on your DB
    Something Like:

    Your DataTable

    Col1 |  Col2
    abc  |  456 
    def  |  789
    

    On Your Code Behind do something like:

    foreach(DataRow row in YourDataTable.Rows)
    {
    
      string myColumn1  = row["Col1"].ToString();  
      int mycolumn2 =  Convert.ToInt32(row["Col2"]);
    
      //Your Insert Statement
      //First Loop you will get  
      //myColumn1 = abc and myColumn2=456
      //2nd loop will be def and 789
    
    }
    

    Regards

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

Sidebar

Related Questions

I have a method private static DataTable ParseTable(HtmlNode table) and sometimes this method has
I have a LARGE datatable (500k-1m rows), without going into detail this is a
I have a data.table object like this one library(data.table) a <- structure(list(PERMNO = c(10006L,
I have an asp:ImageButton with OnClick=Btn_OnClick. In Btn_OnClick I have this line: DataTable dtTable
hello I have this code that use to sort a datatable. Dim sortingIndex As
I have a Datatable function like this public DataTable LoadCategory(SetupCategoryBO scBO) { DBConnect myConnection
I have a on memory Datatable like this. I want to produce xml file
I have 3 collection datatable that shows in this below Month: January ID NAME
I have a untyped DataTable that looks like this (srcTbl): date col_1 col_2 ...
dudes, does any of you know how to do this? i have a page

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.