Showing posts with label folks. Show all posts
Showing posts with label folks. Show all posts

Thursday, March 29, 2012

Performance of Data View row filter

Dear Folks,
Please clarify me on whether a filter on dataview is a performance
bottle neck. we know that
we cannot apply successive filters to a data view. so the better way is
having the 'And' condition in the
Filter expression. suppose i have some 4 and conditions in my filter
expression what will be its effect on the
performance.
or is there any other way round. if so please let me know the details of it.
Thanks in advance.
Regards,
Sundararajan.SHi Sundararajan:
Filters can be a drag, but it's impossible to give you a definitive
answer. You have to measure the filters you are using in your
application with the expected load your application will receive to
determine if the performance hit is acceptable or unacceptable.
Does the data underneath the view come from a database query? If so,
one way around the performance problem is to add WHERE or HAVING
clauses to your SQL query - the database is generally much better at
filtering a set of records than .NET is.
Scott
http://www.OdeToCode.com/blogs/scott/
On Tue, 24 May 2005 07:22:04 -0700, Sundararajan
<sundararajan@.discussions.microsoft.com> wrote:

>Dear Folks,
> Please clarify me on whether a filter on dataview is a performance
>bottle neck. we know that
>we cannot apply successive filters to a data view. so the better way is
>having the 'And' condition in the
>Filter expression. suppose i have some 4 and conditions in my filter
>expression what will be its effect on the
>performance.
> or is there any other way round. if so please let me know the details of
it.
>Thanks in advance.
>Regards,
>Sundararajan.S

Performance of Data View row filter

Dear Folks,

Please clarify me on whether a filter on dataview is a performance
bottle neck. we know that
we cannot apply successive filters to a data view. so the better way is
having the 'And' condition in the
Filter expression. suppose i have some 4 and conditions in my filter
expression what will be its effect on the
performance.
or is there any other way round. if so please let me know the details of it.

Thanks in advance.

Regards,
Sundararajan.SHi Sundararajan:

Filters can be a drag, but it's impossible to give you a definitive
answer. You have to measure the filters you are using in your
application with the expected load your application will receive to
determine if the performance hit is acceptable or unacceptable.

Does the data underneath the view come from a database query? If so,
one way around the performance problem is to add WHERE or HAVING
clauses to your SQL query - the database is generally much better at
filtering a set of records than .NET is.

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Tue, 24 May 2005 07:22:04 -0700, Sundararajan
<sundararajan@.discussions.microsoft.com> wrote:

>Dear Folks,
> Please clarify me on whether a filter on dataview is a performance
>bottle neck. we know that
>we cannot apply successive filters to a data view. so the better way is
>having the 'And' condition in the
>Filter expression. suppose i have some 4 and conditions in my filter
>expression what will be its effect on the
>performance.
> or is there any other way round. if so please let me know the details of it.
>Thanks in advance.
>Regards,
>Sundararajan.S

Performance of Xsl Transformations

Folks, I'm running into some performance issues with my Xsl transformations.
I've done a ton of debugging and digging around, and have come to the
conclusion that the performance issues are NOT caused by slow stored
procedures, or bad XSL/Ts.

I came to this conclusion by doing a test transformation in client-side code
instead of server side aspx, as shown at the bottom of this post. The
transformations were super-fast. However, the client-side javascript isn't a
viable solution for my application.

I'm sure that different versions of the XMLDOM are being used when the code
is client-side as opposed to using System.Xml.Xsl.

Here's my C# code. What I'm trying to do is write out an HTML file of my
transformation.

// Create a FileStream to write with
System.IO.FileStream fs = new System.IO.FileStream(exportPath,
System.IO.FileMode.Create);
// Create an XmlTextWriter for the FileStream
System.Xml.XmlTextWriter oXmlTextWriter = new
System.Xml.XmlTextWriter(fs, System.Text.Encoding.Unicode);

try
{
// Set up the XmlResolver
XmlUrlResolver oXmlUrlResolver = new XmlUrlResolver();
oXmlUrlResolver.Credentials = CredentialCache.DefaultCredentials;

// Set up the XslTransform
System.Xml.Xsl.XslTransform oXslTransform = new
System.Xml.Xsl.XslTransform();
oXslTransform.Load(MyXslPath, oXmlUrlResolver);

// Perform Transformation
XmlDataDocument oXmlDataDocument = new XmlDataDocument(MyDataSet);
oXslTransform.Transform(oXmlDataDocument, null, oXmlTextWriter,
oXmlUrlResolver);

// Clean up
oXmlTextWriter.Close();

return exportPath; // defined elsewhere
}
catch (Exception ex)
{
oXmlTextWriter.Close();
System.IO.File.Delete(exportPath);
ExceptionManager.Publish(ex);
throw(ex);
}

The code works, but it's slow. It was suggested that I use an XPathDocument
instead of an XmlDataDocument. How would I do that?
Any suggestions? Thank You

Client-Side Transformation
<%
var sXml = "MyXml.Xml"
var sXsl = "MyXsl.xsl"

var oXmlDoc = Server.CreateObject("MICROSOFT.XMLDOM");
var oXslDoc = Server.CreateObject("MICROSOFT.XMLDOM");
oXmlDoc.async = false;
oXslDoc.async = false;
oXmlDoc.load(Server.MapPath(sXml));
oXslDoc.load(Server.MapPath(sXsl));
Response.Write(oXmlDoc.transformNode(oXslDoc));
%Ok, I figured this out ... I would like to do some research to figure out
why this is faster (MUCH faster).

The slow way:

DataSet oDataSet = populate dataset with some report data
System.IO.FileStream oFileStream = new System.IO.FileStream(exportPath,
System.IO.FileMode.Create);
System.Xml.XmlTextWriter oXmlTextWriter = new
System.Xml.XmlTextWriter(oFileStream, System.Text.Encoding.Unicode);
try
{
XmlUrlResolver oXmlUrlResolver = new XmlUrlResolver();
oXmlUrlResolver.Credentials = CredentialCache.DefaultCredentials;
System.Xml.Xsl.XslTransform oXslTransform = new
System.Xml.Xsl.XslTransform();
oXslTransform.Load(_XslPath, oXmlUrlResolver);
XmlDataDocument oXmlDataDocument = new XmlDataDocument(oDataSet);
oXslTransform.Transform(oXmlDataDocument, null, oXmlTextWriter,
oXmlUrlResolver);
oXmlTextWriter.Close();

return exportPath; // path of exported file
}
catch (Exception ex)
{
oXmlTextWriter.Close();
System.IO.File.Delete(exportPath);
throw(ex);
}

The fast way:

DataSet oDataSet = populate dataset with some report data
XmlTextReader oXmlTextReader = new XmlTextReader(oDataSet.GetXml(),
XmlNodeType.Document, null);
System.IO.FileStream oFileStream = new System.IO.FileStream(exportPath,
System.IO.FileMode.Create);
System.Xml.XmlTextWriter oXmlTextWriter = new
System.Xml.XmlTextWriter(oFileStream, System.Text.Encoding.Unicode);
try
{
XmlUrlResolver oXmlUrlResolver = new XmlUrlResolver();
oXmlUrlResolver.Credentials = CredentialCache.DefaultCredentials;
System.Xml.Xsl.XslTransform oXslTransform = new
System.Xml.Xsl.XslTransform();
oXslTransform.Load(_XslPath, oXmlUrlResolver);
XPathDocument oXPathDocument = new XPathDocument(oXmlReader);
oXslTransform.Transform(oXPathDocument, null, oXmlTextWriter,
oXmlUrlResolver);
oXmlTextWriter.Close();

return exportPath; // path of exported file
}
catch (Exception ex)
{
oXmlTextWriter.Close();
System.IO.File.Delete(exportPath);
throw(ex);
}

"George Durzi" <gdurzi@.hotmail.com> wrote in message
news:#eQPvdwzDHA.1744@.TK2MSFTNGP12.phx.gbl...
> Folks, I'm running into some performance issues with my Xsl
transformations.
> I've done a ton of debugging and digging around, and have come to the
> conclusion that the performance issues are NOT caused by slow stored
> procedures, or bad XSL/Ts.
> I came to this conclusion by doing a test transformation in client-side
code
> instead of server side aspx, as shown at the bottom of this post. The
> transformations were super-fast. However, the client-side javascript isn't
a
> viable solution for my application.
> I'm sure that different versions of the XMLDOM are being used when the
code
> is client-side as opposed to using System.Xml.Xsl.
> Here's my C# code. What I'm trying to do is write out an HTML file of my
> transformation.
> // Create a FileStream to write with
> System.IO.FileStream fs = new System.IO.FileStream(exportPath,
> System.IO.FileMode.Create);
> // Create an XmlTextWriter for the FileStream
> System.Xml.XmlTextWriter oXmlTextWriter = new
> System.Xml.XmlTextWriter(fs, System.Text.Encoding.Unicode);
> try
> {
> // Set up the XmlResolver
> XmlUrlResolver oXmlUrlResolver = new XmlUrlResolver();
> oXmlUrlResolver.Credentials = CredentialCache.DefaultCredentials;
> // Set up the XslTransform
> System.Xml.Xsl.XslTransform oXslTransform = new
> System.Xml.Xsl.XslTransform();
> oXslTransform.Load(MyXslPath, oXmlUrlResolver);
> // Perform Transformation
> XmlDataDocument oXmlDataDocument = new XmlDataDocument(MyDataSet);
> oXslTransform.Transform(oXmlDataDocument, null, oXmlTextWriter,
> oXmlUrlResolver);
> // Clean up
> oXmlTextWriter.Close();
> return exportPath; // defined elsewhere
> }
> catch (Exception ex)
> {
> oXmlTextWriter.Close();
> System.IO.File.Delete(exportPath);
> ExceptionManager.Publish(ex);
> throw(ex);
> }
>
> The code works, but it's slow. It was suggested that I use an
XPathDocument
> instead of an XmlDataDocument. How would I do that?
> Any suggestions? Thank You
>
> Client-Side Transformation
> <%
> var sXml = "MyXml.Xml"
> var sXsl = "MyXsl.xsl"
> var oXmlDoc = Server.CreateObject("MICROSOFT.XMLDOM");
> var oXslDoc = Server.CreateObject("MICROSOFT.XMLDOM");
> oXmlDoc.async = false;
> oXslDoc.async = false;
> oXmlDoc.load(Server.MapPath(sXml));
> oXslDoc.load(Server.MapPath(sXsl));
> Response.Write(oXmlDoc.transformNode(oXslDoc));
> %>

Friday, March 16, 2012

Persistent information...

Hi folks,

Am new to asp.net and I'm trying to find out how to keep persistent
information.

The main thing I need to do is carry round an encrypted connection string
for my database, but there are likelly to be other 'system' scoped data that
I'll need (database roles come to mind).

I've looked at the web.config file, but that only allows a static connection
string. I'm using forms authentication with a mixed mode SQL 2K server.

Cheers...PYou can use either Application variables, which exist for all users
for a web application, or Session variables, which exist for a
particular user session.

To use,

Application("MyApplicationVariable") = "Hello World"
or
Session("MySessionVariable")=123.45

"Paul M" <masonp@.trials.bham.ac.uk> wrote in message
news:ODrkbTNuDHA.2308@.TK2MSFTNGP09.phx.gbl...
> Hi folks,
> Am new to asp.net and I'm trying to find out how to keep persistent
> information.
> The main thing I need to do is carry round an encrypted connection
string
> for my database, but there are likelly to be other 'system' scoped
data that
> I'll need (database roles come to mind).
> I've looked at the web.config file, but that only allows a static
connection
> string. I'm using forms authentication with a mixed mode SQL 2K
server.
> Cheers...P