Click here to Skip to main content
15,891,409 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
C#
DataSet DS = new DataSet("DS");
Business Obj_business = new Business();
DataTable Dt = new DataTable("DT");
Dt.Columns.Add("NAME", typeof(string));

foreach (RepeaterItem item in rptr_bulk.Items)
{
    TextBox txt_insert = ((TextBox)item.FindControl("txt_insert"));
    Dt.Rows.Add(txt_insert.Text);
}

DS.Tables.Add(Dt);
int status = Obj_business.InsertBulk(DS.GetXml());
if (status > 0)
{
    Response.Write("Success");
    Initialize_Repeater();
}
else
{
    Response.Write("Failed");
    Initialize_Repeater();
}


SQL
SET NOCOUNT ON;

declare @IDOC int
exec sp_xml_preparedocument @IDOC output, @XML
insert into Tbl_New(Name)
select XName 
from openxml(@IDOC,'DS/DT',2)
with
(
XName nvarchar(50) 'NAME'
)
exec sp_xml_removedocument @IDOC
Posted
v2
Comments
So what is the issue here?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900