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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T14:46:48+00:00 2026-06-04T14:46:48+00:00

With sincere help from experts in this wonderful forum, I have been able to

  • 0

With sincere help from experts in this wonderful forum, I have been able to parsed my xml returned by a SharePoint list to get the desired list items into C# Lists.

XDocument xdoc = XDocument.Parse(activeItemData.InnerXml);
XNamespace z = "#RowsetSchema";

List<int> listID = (from row in xdoc.Descendants(z + "row") 
select (int)row.Attribute("ows_ID")).ToList();

List<string> listTitle = (from row in xdoc.Descendants(z + "row") 
select (string)row.Attribute("ows_LinkTitle")).ToList();

I have created a SQL table and I want to insert values in my table using Lists listID and listTitle as parameters

System.Data.SqlClient.SqlConnection sqlConnection1 =
            new System.Data.SqlClient.SqlConnection(MyconnectionString);

            System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand();
            cmd.CommandType = System.Data.CommandType.Text;
            cmd.CommandText = "INSERT TechOpsProjectTracker (ID, [Project Name]) VALUES (@ID, @ProjectName)";

//What I want to do:
            //1. @ID should get the values from the List listID: List<int> listID = (from row in xdoc.Descendants(z + "row") select (int)row.Attribute("ows_ID")).ToList();
            //2. @ProjectName should get the values from the List listTitle: List<string> listTitle = (from row in xdoc.Descendants(z + "row") select (string)row.Attribute("ows_LinkTitle")).ToList();
            //3. so each new record inserted in the table has ID and its corresponding Project Name. Something like this
            /* ID    Project Name
               360   GEI Survey data to Sharepoint
               378   Create back end and environment to support User demographic reporting


             */

There might be some other possibly easier ways to accomplish my job. Please let me know. TIA.

  • 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-04T14:46:49+00:00Added an answer on June 4, 2026 at 2:46 pm

    Setup a user defined type similar to.

    CREATE TYPE [dbo].[tableOf_Ints] AS TABLE(
        [ID] [int] NULL
    )
    GO
    

    Then you can can use it like this.

    public static SqlCommand CreateCommand(List<int> ints)
    {
        var dt = new DataTable();
        dt.Columns.Add("ID",typeof(Int32));
        for (int i = 0; i < ints.Count; i++)
        {
            dt.Rows.Add(ints[i]);
        }
    
        SqlCommand cmd = new SqlCommand("SomeStoredProc");
        cmd.CommandType = CommandType.StoredProcedure;
        cmd.CommandTimeout = 120;
        var param1 = cmd.Parameters.AddWithValue("@SomeParam", dt);
        param1.SqlDbType = SqlDbType.Structured;
        param1.TypeName = "dbo.tableOf_Ints";
    
        return cmd;
    }
    

    Assuming you have a stored proc like this.

    CREATE PROCEDURE [dbo].[SomeStoredProc]  
        @SomeParam TableOf_Ints READONLY
    AS
    BEGIN
    END
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My sincere apologies if this question has been asked, but I really couldn't find
I hope this question (or one similar) hasn't been asked before. Sincere apologies if
I wonder whether someone may be able to help me please. Firstly, my sincere
First up, this might be the wrong place to ask this question.. So, sincere
I'm going to need to push and pull files from a SharePoint site that
EDIT: My sincere apologies! This wasn't an issue with anything but myself - I
This may be a doozy, but does anyone have an idea how to: Pass
I have been trying to position content within a table row. The row in
I have a 'n' column table , the first column is a drop down
I have a bash file, which I’m trying to run in Cygwin on a

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.