Blog Home  Home Feed your aggregator (RSS 2.0)  
Software Code Help - Tuesday, July 07, 2009
Blog
 
# Tuesday, July 07, 2009

Caching is the technique of storing an in-memory copy of some information that’s expensive to create. For example, you could cache the results of a complex query so that subsequent requests don’t need to access the database at all. Instead, they can grab the appropriate object directly from server memory—a much faster proposition. The real beauty of caching is that unlike many other performance-enhancing techniques, caching bolsters both performance and scalability.


Output caching: This is the simplest type of caching. It stores a copy of the final rendered HTML page that is sent to the client. The next client that submits a request for this page doesn’t actually run the page. Instead, the final HTML output is sent automatically. The time that would have been required to run the page and its code is completely reclaimed.

Data caching: This type of caching is carried out manually in your code. To use data caching, you store important pieces of information that are time-consuming to reconstruct (such as a DataSet retrieved from a database) in the cache. Other pages can check for the existence of this information and use it, thereby bypassing the steps ordinarily required to retrieve it.

Fragment caching: This is a specialized type of output caching—instead of caching the HTML for the whole page, it allows you to cache the HTML for a portion of it. Fragment caching works by storing the rendered HTML output of a user control on a page. The next time the page is executed, the same page events fire (and so your page code will still run), but the code for the appropriate user control isn’t executed.

Data source caching: This is the caching that’s built into the data source controls, including the SqlDataSource, ObjectDataSource, and XmlDataSource. Technically, data source caching uses data caching. The difference is that you don’t need to handle the process explicitly.
Instead, you simply configure the appropriate properties, and the data source control manages the caching storage and retrieval.

Tuesday, July 07, 2009 7:08:32 AM (GMT Daylight Time, UTC+01:00)  #    Comments [0]   asp.net  | 
# Friday, July 03, 2009

When we roll back our transaction, it nullifies the effect of every command you’ve executed since you started the last transaction. But what happens if you want to roll back only part of an ongoing transaction? SQL Server handles this with a feature called savepoints.

Savepoints are markers that act like bookmarks. You mark a certain point in the flow of the transaction, and then you can roll back to that point. You set the savepoint using the Transaction.Save() method.

Here’s a conceptual look at how you use a savepoint:

// Start the transaction.
SqlTransaction trans = Connection.BeginTransaction();
// Mark a savepoint.
trans.Save("CompletedUpdate");
// If needed, roll back to the savepoint.
trans.Rollback("CompletedUpdate");
// Commit or roll back the transaction.
trans.Commit();
Friday, July 03, 2009 12:35:56 PM (GMT Daylight Time, UTC+01:00)  #    Comments [0]   Interview Question ADO.NET  | 

ExecuteNonQuery() Executes non-SELECT commands, such as SQL commands that insert, delete, or update records. The returned value indicates the number of rows affected by the command. You can also use ExecuteNonQuery() to execute data-definition commands that create, alter, or delete database objects (such as tables, indexes, constraints, and so on).

ExecuteScalar() Executes a SELECT query and returns the value of the first field of the first row from the rowset generated by the command. This method is usually used when executing an aggregate SELECT command that uses functions such as COUNT() or SUM() to calculate a single value.

ExecuteReader() Executes a SELECT query and returns a DataReader object that wraps a read-only, forward-only cursor.

Friday, July 03, 2009 12:14:25 PM (GMT Daylight Time, UTC+01:00)  #    Comments [0]   Interview Question ADO.NET  | 
# Thursday, July 02, 2009

A data provider is a set of ADO.NET classes that allows you to access a specific database, execute SQL commands, and retrieve data. Essentially, a data provider is a bridge between your application and a data source.

There are four type of providers in .net:

SQL Server provider: Provides optimized access to a SQL Server database (version 7.0 or later).

OLE DB provider: Provides access to any data source that has an OLE DB driver. This includes SQL Server databases prior to version 7.0.

Oracle provider: Provides optimized access to an Oracle database (version 8i or later).

ODBC provider: Provides access to any data source that has an ODBC driver.

Thursday, July 02, 2009 12:02:02 PM (GMT Daylight Time, UTC+01:00)  #    Comments [0]   Interview Question ADO.NET  | 

ADO.NET has two types of objects: connection-based and content-based.

Connection-based objects: These are the data provider objects such as Connection, Command, DataReader, and DataAdapter. They allow you to connect to a database, execute SQL statements, move through a read-only result set, and fill a DataSet. The connection-based objects are specific to the type of data source, and are found in a provider-specific namespace (such as System.Data.SqlClient for the SQL Server provider).

Content-based objects: These objects are really just "packages" for data. They include the DataSet, DataColumn, DataRow, DataRelation, and several others. They are completely independent of the type of data source and are found in the System.Data namespace.

Thursday, July 02, 2009 11:58:47 AM (GMT Daylight Time, UTC+01:00)  #    Comments [0]   Interview Question ADO.NET  | 
# Wednesday, July 01, 2009

There are three type of CommandType enumeration in ADO.NET.

CommandType.Text The command will execute a direct SQL statement. The SQL statement is provided in the CommandText property. This is the default value.

CommandType.StoredProcedure The command will execute a stored procedure in the data source. The CommandText property provides the name of the stored procedure.

CommandType.TableDirect The command will query all the records in the table. The CommandText is the name of the table from which the command will retrieve the records.

Wednesday, July 01, 2009 12:10:36 PM (GMT Daylight Time, UTC+01:00)  #    Comments [0]   Interview Question ADO.NET  | 
# Monday, June 29, 2009
In ASP.NET 2.0, managing controls has become easier. Instead of declaring them on every page, you can declare them only once in your web.config file and use them in your entire project.
<configuration>
    <system.web>       
      <pages>
            <controls>
                  <add tagPrefix="portal" tagName="Top"src="~/Controls/Top.ascx" />
            </controls >
      </pages >  
    </system.web>
</configuration>
Once you have registered this control in your web.config, you can use this control on any page without explicitly adding a register directive on the page.
<body>
    <form id="form1" runat="server">
    <div>
        <portal:Top ID="Top1" runat="server" />
    </div>
    </form>
</body>
 
Monday, June 29, 2009 10:03:00 AM (GMT Daylight Time, UTC+01:00)  #    Comments [0]   asp.net  | 
# Friday, June 26, 2009

One difference is that web forms start with the Page directive, a master page starts with a Master directive that specifies the same information, as shown here:

<%@ Master Language="C#" AutoEventWireup="true" CodeFile="SiteTemplate.master.cs" Inherits="SiteTemplate" %>

Another difference between master pages and ordinary web forms is that master pages can use the ContentPlaceHolder control, which isn’t allowed in ordinary pages. The ContentPlaceHolder is a portion of the page where the content page can insert content.

Friday, June 26, 2009 12:47:09 PM (GMT Daylight Time, UTC+01:00)  #    Comments [0]   asp.net  | 
# Wednesday, June 24, 2009

Every .aspx page starts with a Page directive. This Page directive specifies the language for the page,
and it also tells ASP.NET where to find the associated code

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="FileName.aspx.cs" Inherits="FileName"%>

Notice that Visual Studio uses a slightly unusual naming syntax for the source code file. It has
the full name of the corresponding web page, complete with the .aspx extension, followed by the .cs
extension at the end.

Wednesday, June 24, 2009 12:40:20 PM (GMT Daylight Time, UTC+01:00)  #    Comments [0]   asp.net  | 

The latest version of Visual Studio has some long-awaited improvements. They include the following:

Web projects: Visual Studio 2005 replaced the traditional project-based web application model with a lighterweight system of projectless development. However, this change didn’t please everyone, and so Microsoft released an add-on that brought the web project option back. In Visual Studio 2008, developers get the best of both worlds, and can choose to create projectless or project-based web applications depending on their needs.

Multitargeting: Web servers won’t shift overnight from .NET 2.0 to .NET 3.5. With this in mind, Visual Studio now gives you the flexibility to develop applications that target any version of the .NET Framework, from version 2.0 on.

CSS: In order to apply consistent formatting over an entire website, developers often use the Cascading Style Sheets (CSS) standard. Now Visual Studio makes it even easier to link web pages to stylesheets, and pick and choose the styles you want to apply to various elements in your page without editing the markup by hand.

Wednesday, June 24, 2009 12:05:21 PM (GMT Daylight Time, UTC+01:00)  #    Comments [0]   .Net  | 
Copyright © 2010 SoftwareCodeHelp. All rights reserved.
DasBlog 'Portal' theme by Johnny Hughes.
Pick a theme: