Blog Home  Home Feed your aggregator (RSS 2.0)  
Software Code Help - Friday, July 03, 2009
Blog
 
# 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  | 

LINQ and Ajax are the two new features introduced in ASP.NET 3.5

LINQ
-----
LINQ (Language Integrated Query) is a set of extensions for the C# and Visual Basic languages. It allows you to write C# or Visual Basic code that manipulates in-memory data in much the same way you query a database.

Technically, LINQ defines about 40 query operators, such as select, from, in, where, and orderby (in C#). These operators allow you to code your query. However, there are various types of data on which this query can be performed, and each type of data requires a separate flavor  of LINQ.

AJAX
-----
Ajax(Asynchronous JavaScript and XML)is programming shorthand for a client-side technique that allows your page to call the server and update its content without triggering a complete postback. Typically, an Ajax page uses client-side script code to fire an asynchronous request behind the scenes. The server receives this request, runs some code, and then returns the data your page needs (often as a block of XML markup). Finally, the client-side code receives the new data and uses it to perform another action, such as refreshing part of the page.

Green Bits and Red Bits
-------------------------
Oddly enough, ASP.NET 3.5 doesn’t include a full new version of ASP.NET. Instead, ASP.NET 3.5 is designed as a set of features that add on to .NET 2.0. The parts of .NET that haven’t changed in .NET 3.5 are often referred to as red bits, while the parts that have changed are called green bits. The red bits include the CLR, the ASP.NET engine, and all the class libraries from .NET 2.0. In
other words, if you build a new ASP.NET 3.5 application, it gets exactly the same runtime environment as an ASP.NET 2.0 application. Additionally, all the classes you used in .NET 2.0—including those for connecting to a database, reading and writing files, using web controls, and so on—remain the same in .NET 3.5. The red bits also include the features that were included in .NET 3.0, such as WCF. All the assemblies in .NET 3.5 retain their original version numbers. That means .NET 3.5 includes a mix of 2.0, 3.0, and 3.5 assemblies. If you’re curious when an assembly was released, you simply need to check the version number.

The ASP.NET 3.5 green bits consist of a small set of assemblies with new types. For ASP.NET developers, the important new assemblies include the following:

• System.Core.dll: Includes the core LINQ functionality
• System.Data.Linq.dll: Includes the implementation for LINQ to SQL
• System.Data.DataSetExtensions.dll:. Includes the implementation for LINQ to DataSet
• System.Xml.Linq.dll: Includes the implementation for LINQ to XML
• System.Web.Extensions.dll: Includes the implementation for ASP.NET AJAX and new web controls


Silverlight
-----------
Recently, there’s been a lot of excitement about Silverlight, a new Microsoft technology that allows a variety of browsers on a variety of operating systems to run true .NET code. Silverlight works through a browser plug-in, and provides a subset of the .NET Framework class library. This subset includes a slimmed-down version of WPF, the technology that developers use to craft next-generation Windows user interfaces.

Silverlight is all about client code—quite simply, it allows you to create richer pages than you could with HTML, DHTML, and JavaScript alone. In many ways, Silverlight duplicates the features and echoes the goals of Adobe Flash. By using Silverlight in a web page, you can draw sophisticated 2D graphics, animate a scene, and play video and other media files.

Wednesday, June 24, 2009 11:24:55 AM (GMT Daylight Time, UTC+01:00)  #    Comments [0]   asp.net  | 
Copyright © 2010 SoftwareCodeHelp. All rights reserved.
DasBlog 'Portal' theme by Johnny Hughes.
Pick a theme: