Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Other Office > Infopath
|
Infopath Programming and automation discussions only please. :)
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Infopath section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 18th, 2007, 06:21 PM
Registered User
 
Join Date: Nov 2003
Posts: 6
Thanks: 0
Thanked 1 Time in 1 Post
Default Extreme performance problems with a repeating tabl

Hi to all!!!!

I have a problem with performance of a template working in browser mode. It seems that filling a repeating table using a XmlWriter is the case.

First I tried to fill like this:

foreach (DataRow row in dataTable.Rows)
{
                string myNamespace = NamespaceManager.LookupNamespace("my");
                using (XmlWriter writer = MainDataSource.CreateNavigator().SelectSingleNode( "/my:myFields/my:group1", NamespaceManager).AppendChild())
                {
                               writer.WriteStartElement("Values", myNamespace);

                               writer.WriteElementString("Value1", myNamespace, row["Value1"].ToString());
                               writer.WriteElementString("Value2", myNamespace, row["Value2"].ToString());
                                writer.WriteElementString("Value3", myNamespace, row["Value3"].ToString());
                               writer.WriteElementString("Value4", myNamespace, row["Value4"].ToString());
                               writer.WriteElementString("Value5", myNamespace, row["Value5"].ToString());

                               writer.WriteEndElement();
                               writer.Close();
                }
}

While opening in browser after about half a minute a dialog box apper saying that "A Scripts on this page is causing Internet Explorer to run slowly. If it

continues to run, your computer may become unresponsive".

The InternetExplorer 7 has at this time OVER 0,5 gigs in the task manager!!!!!!!! (The server an the client is up-to-date with all services packs)


It seemed to me that AppendChild() method is the problem so I tried first to generate the xml with the data to MemoryStream:

MemoryStream memoryStream = new MemoryStream();
XmlWriter memoryXmlWriter = XmlWriter.Create(memoryStream);

string myNamespace = NamespaceManager.LookupNamespace("my");

foreach (DataRow row in dtTasks.Rows)
{
                memoryXmlWriter.WriteStartElement("Values", myNamespace);

                 memoryXmlWriter.WriteElementString("Value1", myNamespace, row["Value1"].ToString());
                memoryXmlWriter.WriteElementString("Value2", myNamespace, row["Value2"].ToString());
                memoryXmlWriter.WriteElementString("Value3", myNamespace, row["Value3"].ToString());
                memoryXmlWriter.WriteElementString("Value4", myNamespace, row["Value4"].ToString());
                memoryXmlWriter.WriteElementString("Value5", myNamespace, row["Value5"].ToString());

                memoryXmlWriter.WriteEndElement();
}

memoryXmlWriter.Flush();
memoryXmlWriter.Close();

string outStr = Encoding.UTF8.GetString(memoryStream.ToArray());

//Add "my:" and "/my:" prefix
string rtXml = AddPrefixMy(outStr);

And then replace directly repeating table InnerXml:

MainDataSource.CreateNavigator().SelectSingleNode( "/my:myFields/my:group1", NamespaceManager).InnerXml = rtXml;

While opening in browser nothing changes and the same dialog box appers.

Do you have any ideas how to optimize this code.

Thanks for ANY reply !!!!!!!!!!!!!!!







Similar Threads
Thread Thread Starter Forum Replies Last Post
auto update from 1 table to column in another tabl headwaters Access 1 December 1st, 2008 08:39 AM
repeating data ph0neman Classic ASP Basics 5 January 18th, 2008 12:34 PM
Datagrid performance problems GS C# 2005 1 April 18th, 2007 03:05 AM
how to addd one to one reletionship between 2 tabl method SQL Server 2000 3 June 5th, 2005 07:44 AM
Repeating textboxes Robert_Hill BOOK: Professional SQL Server Reporting Services ISBN: 0-7645-6878-7 0 September 2nd, 2004 10:42 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.