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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T07:04:45+00:00 2026-06-03T07:04:45+00:00

I’m a beginner, I want to fetch data from Zoho Crm and then insert

  • 0

I’m a beginner, I want to fetch data from Zoho Crm and then insert it into a SQL Server database by calling a stored procedure in C#

My way :

  1. Using Zoho API whit URL (it works well)

  2. Using XmlDocument to load XML data from URL above (it work well)

My code :

XmlDocument doc = new XmlDocument();
doc.Load("https://crm.zoho.com/crm/private/xml/Accounts/getRecords?newFormat=1&authtoken=mytoken&scope=crmapi&lastModifiedTime=2011-05-27%2000:00:00&fromIndex=1482&toIndex=1682");

Now how to insert to database using stored procedure?

Data example :

Note : the number of FL element maybe difference in each row

<response uri="/crm/private/xml/Accounts/getRecords">
  <result>
    <Accounts>
      <row no="1">
        <FL val="ACCOUNTID">380198000000068646</FL>
        <FL val="SMOWNERID">380198000000052013</FL>
        <FL val="Account Owner">Mai Tran</FL>
        <FL val="Account Name">Trung Tâm Nghiên Cứu & Phát Triển Chế Biến Dầu Khí</FL>
        <FL val="Website">www.pvpro.com.vn</FL>
        <FL val="Industry">Energy, Oil & Gas</FL>
        <FL val="SMCREATORID">380198000000041003</FL>
        <FL val="Created By">Bach Tran Phuong</FL>
        <FL val="MODIFIEDBY">380198000000041003</FL>
        <FL val="Modified By">Tran Phuong</FL>
        <FL val="Created Time">2011-05-04 09:49:11</FL>
        <FL val="Modified Time">2012-02-24 14:41:48</FL>
        <FL val="Billing Street">4 Nguyen Thong St</FL>
        <FL val="District">Q.3</FL>
        <FL val="City">Hồ Chí Minh</FL>
      </row>
      <row no="2">
        <FL val="ACCOUNTID">380198000000068644</FL>
        <FL val="SMOWNERID">380198000000041003</FL>
        <FL val="Account Owner">Bach Tran Phuong</FL>
        <FL val="Account Name">Tổng Cty Tư Vấn Thiết Kế</FL>
        <FL val="Phone">6297 1778</FL>
        <FL val="SMCREATORID">380198000000041003</FL>
        <FL val="Created By">Bach Tran Phuong</FL>
        <FL val="MODIFIEDBY">380198000000041003</FL>
        <FL val="Modified By">Tran Phuong</FL>
        <FL val="Created Time">2011-05-04 09:49:11</FL>
        <FL val="Modified Time">2012-02-24 14:40:42</FL>
        <FL val="Billing Street">Parkson Tân Sân Nhất</FL>
        <FL val="District">Tân Bình</FL>
        <FL val="City">Hồ Chí Minh</FL>
        <FL val="Alternative Names">PV Engineering</FL>
      </row>
      <row no="3">
        <FL val="ACCOUNTID">380198000000068642</FL>
        <FL val="SMOWNERID">380198000000052015</FL>
        <FL val="Account Owner">Trang Do Thi</FL>
        <FL val="Account Name">CTY TNHH BẢO HIỂM NHÂN THỌ VIỆT NAM</FL>
        <FL val="Phone">9 101 660</FL>
        <FL val="Account Type">Active</FL>
        <FL val="Industry">Financial Services</FL>
        <FL val="SMCREATORID">380198000000041003</FL>
        <FL val="Created By">Bach Tran Phuong</FL>
        <FL val="MODIFIEDBY">380198000000041003</FL>
        <FL val="Modified By">Tran Phuong</FL>
        <FL val="Created Time">2011-05-04 09:49:11</FL>
        <FL val="Modified Time">2012-04-27 11:02:25</FL>
        <FL val="Billing Street"> Tôn Đức Thắng P.Bến Nghé</FL>
        <FL val="Phone 2">9 101 659</FL>
        <FL val="District">Q.1</FL>
        <FL val="City">Hồ Chí Minh</FL>
        <FL val="Key Contact">Duy Nhật</FL>
        <FL val="Partner Type">Loyal Partner</FL>
        <FL val="Collection">1859353554</FL>
        <FL val="Alternative Names">Việt Nam</FL>
      </row>
      <row no="4">
        <FL val="ACCOUNTID">380198000000068638</FL>
        <FL val="SMOWNERID">380198000000052015</FL>
        <FL val="Account Owner">Trang Do Thi</FL>
        <FL val="Account Name">Cty TNHH Gia Dụng Phương Gia</FL>
        <FL val="SMCREATORID">380198000000041003</FL>
        <FL val="Created By">Bach Tran Phuong</FL>
        <FL val="MODIFIEDBY">380198000000041003</FL>
        <FL val="Modified By">Bach Tran Phuong</FL>
        <FL val="Created Time">2011-05-04 09:49:11</FL>
        <FL val="Modified Time">2012-02-24 13:52:25</FL>
        <FL val="Billing Street">Cao Thang</FL>
        <FL val="District">Q.3</FL>
        <FL val="City">Hồ Chí Minh</FL>
        <FL val="Alternative Names">Home Appliances ltd</FL>
      </row>
    </Accounts>
  </result>
</response>
  • 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-03T07:04:47+00:00Added an answer on June 3, 2026 at 7:04 am

    Step 1: create your stored procedure:

    CREATE PROCEDURE dbo.StoreXmlData (@XmlData XML)
    AS BEGIN
        INSERT INTO dbo.YourXmlTable(XmlColumnName)
        VALUES(@XmlData)
    END
    

    This assumes you’re on SQL Server 2005 or newer, and you’re storing your XML in a column that is really of datatype XML. Adapt table and column name as needed to match your situation.

    Step 2: from C#, call your stored procedure using standard ADO.NET classes:

    string sqlStmt = "dbo.StoreXmlData";  // name of your stored procedure
    
    // here, you need to use *YOUR* connection string instead of my demo one...    
    using(SqlConnection conn = new SqlConnection("server=.;database=test;integrated security=SSPI;"))
    using (SqlCommand cmd = new SqlCommand(sqlStmt, conn))
    {
        // make sure to tell ADO.NET you're about to call a stored procedure!
        cmd.CommandType = CommandType.StoredProcedure;
    
        // define the parameter and set its value
        cmd.Parameters.Add("@YourData", SqlDbType.Xml);
        cmd.Parameters["@YourData"].Value = doc.DocumentElement.InnerXml;
    
        // standard ADO.NET - open connection, execute query, close connection
        conn.Open();
        cmd.ExecuteNonQuery();
        conn.Close();
    }
    

    That’s really all there is!

    Update: OK, so you want to actually shred the XML into individual columns – in that case, you need to do something like this in your stored procedure:

    CREATE PROCEDURE dbo.StoreXmlData (@XmlData XML)
    AS 
    BEGIN
        INSERT INTO dbo.YourDataTable(RowNo, AccountID, OwnerID, AccountOwner)
            SELECT
                RowNo = Acc.value('@no', 'int'),
                AccountID = Acc.value('(FL[@val="ACCOUNTID"])[1]', 'nvarchar(50)'),
                OwnerID = Acc.value('(FL[@val="SMOWNERID"])[1]', 'nvarchar(50)'),
                AccountOwner = Acc.value('(FL[@val="Account Owner"])[1]', 'nvarchar(50)')
                -- and so on to grab all the items you need
            FROM
                @XmlData.nodes('/response/result/Accounts/row') AS Resp(Acc)
    END
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a French site that I want to parse, but am running into
I am currently running into a problem where an element is coming back from
I want to construct a data frame in an Rcpp function, but when I
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I want use html5's new tag to play a wav file (currently only supported
I'm parsing an RSS feed that has an &#8217; 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.