registration
Are you an Employer?

ASP.NET interview questions & Answers

Asp.net Related links

List of Topics
ASP.NET Interview Questions

ASP.NET Interview questions

  • What Are The New Data Controls In Asp.net 2.0?

    Data access in ASP.NET 2.0 can be accomplished completely declaratively (no code) using the new data-bound and data source controls. There are new data source controls to represent different data backends such as SQL database, business objects, and XML, and there are new data-bound controls for rendering common UI for data, such as gridview, detailsview, and formview.

  • What Are The New Navigation Controls In Asp.net 2.0?

    The navigation controls provide common UI for navigating between pages in your site, such as treeview, menu, and sitemappath. These controls use the site navigation service in ASP.NET 2.0 to retrieve the custom structure you have defined for your site.

  • What Are The New Login Controls In Asp.net 2.0?

    The new login controls provide the building blocks to add authentication and authorization-based UI to your site, such as login forms, create user forms, password retrieval, and custom UI for logged in users or roles. These controls use the built-in membership and role services in ASP.NET 2.0 to interact with the user and role information defined for your site.

  • What Are The New Web Part Controls In Asp.net 2.0 ?

    Web parts are an exciting new family of controls that enable you to add rich, personalized content and layout to your site, as well as the ability to edit that content and layout directly from your application pages. These controls rely on the personalization services in ASP.NET 2.0 to provide a unique experience for each user in your application.

  • What Are Master Pages?

    Master Page feature provides the ability to define common structure and interface elements for your site, such as a page header, footer, or navigation bar, in a common location called a "master page", to be shared by many pages in your site. In one simple place you can control the look, feel, and much of functionality for an entire Web site. This improves the maintainability of your site and avoids unnecessary duplication of code for shared site structure or behavior.

  • What Are Themes And Skins In 2.0, Explain Usage Scenario?

    The themes and skins features in ASP.NET 2.0 allow for easy customization of your site's look-and-feel. You can define style information in a common location called a "theme", and apply that style information globally to pages or controls in your site. Like Master Pages, this improves the maintainability of your site and avoid unnecessary duplication of code for shared styles.

  • What Is A Profile Object, Why Is It Used?

    Using the new personalization services in ASP.NET 2.0 you can easily create customized experiences within Web applications. The Profile object enables developers to easily build strongly-typed, sticky data stores for user accounts and build highly customized, relationship based experiences. At the same time, a developer can leverage Web Parts and the personalization service to enable Web site visitors to completely control the layout and behavior of the site, with the knowledge that the site is completely customized for them. Personalizaton scenarios are now easier to build than ever before and require significantly less code and effort to implement.

  • What Is Configuration Api?

    ASP.NET 2.0 contains new configuration management API's, enabling users to programmatically build programs or scripts that create, read, and update Web.config and machine.config configuration files.

  • What Is Mmc Admin Tool?

    ASP.NET 2.0 provides a new comprehensive admin tool that plugs into the existing IIS Administration MMC, enabling an administrator to graphically read or change common settings within our XML configuration files.

  • Explain The Use Of Pre-compilation Tool?

    ASP.NET 2.0 delivers a new application deployment utility that enables both developers and administrators to precompile a dynamic ASP.NET application prior to deployment. This precompilation automatically identifies any compilation issues anywhere within the site, as well as enables ASP.NET applications to be deployed without any source being stored on the server (one can optionally remove the content of .aspx files as part of the compile phase), further protecting your intellectual property.

  • How Is Application Management And Maintenance Improved In Asp.net 2.0?

    ASP.NET 2.0 also provides new health-monitoring support to enable administrators to be automatically notified when an application on a server starts to experience problems. New tracing features will enable administrators to capture run-time and request data from a production server to better diagnose issues. ASP.NET 2.0 is delivering features that will enable developers and administrators to simplify the day-to-day management and maintenance of their Web applications.

  • What Are Provider-driven Application Services? Explain In Detail?

    ASP.NET 2.0 now includes built-in support for membership (user name/password credential storage) and role management services out of the box. The new personalization service enables quick storage/retrieval of user settings and preferences, facilitating rich customization with minimal code. The new site navigation system enables developers to quickly build link structures consistently across a site. As all of these services are provider-driven, they can be easily swapped out and replaced with your own custom implementation. With this extensibility option, you have complete control over the data store and schema that drives these rich application services.

  • Explain Server Control Extensibility With Reference To Asp.net 2.0 ?

    ASP.NET 2.0 includes improved support for control extensibility, such as more base classes that encapsulate common behaviors, improved designer support, more APIs for interacting with client-side script, metadata-driven support for new features like themes and accessibility verification, better state management, and more.

  • What Are The Data Source Controls?

    Data access in ASP.NET 2.0 is now performed declaratively using data source controls on a page. In this model, support for new data backend storage providers can be easily added by implementing custom data source controls. Additionally, the SqlDataSource control that ships in the box has built-in support for any ADO.NET managed provider that implements the new provider factory model in ADO.NET.

  • What Are Compilation Build Providers?

    Dynamic compilation in ASP.NET 2.0 is now handled by extensible compilation build providers, which associate a particular file extension with a handler that knows how to compile that extension dynamically at runtime. For example, .resx files can be dynamically compiled to resources, .wsdl files to web service proxies, and .xsd files to typed DataSet objects. In addition to the built-in support, it is easy to add support for additional extensions by implementing a custom build provider and registering it in Web.config.

  • What Is Expression Builders, Why Would You Use It?

    ASP.NET 2.0 introduces a declarative new syntax for referencing code to substitute values into the page, called Expression Builders. ASP.NET 2.0 includes expression builders for referencing string resources for localization, connection strings, application settings, and profile values. You can also write your own expression builders to create your own custom syntax to substitute values in a page rendering.

  • Is Asp.net 64-bit Enabled? How?

    ASP.NET 2.0 is now 64-bit enabled, meaning it can take advantage of the full memory address space of new 64-bit processors and servers. Developers can simply copy existing 32-bit ASP.NET applications onto a 64-bit ASP.NET 2.0 server and have them automatically be JIT compiled and executed as native 64-bit applications (no source code changes or manual re-compile are required).

  • Explain How Caching In Asp.net 2.0 Is Different From Caching In Asp.net 1.1?

    ASP.NET 2.0 also now includes automatic database server cache invalidation. This powerful and easy-to-use feature allows developers to aggressively output cache database-driven page and partial page content within a site and have ASP.NET automatically invalidate these cache entries and refresh the content whenever the back-end database changes. Developers can now safely cache time-critical content for long periods without worrying about serving visitors state data.

  • Can We Bind Data To A Server Control Without Writing Code In .net?

    Yes, that is possible. ASP.NET 2.0 has the feature of declarative solution for data binding which requires no code at all for the most common data scenarios, such as:
    *Selecting and displaying
    *Data Sorting
    *Paging and Caching
    *Data Updating
    *Inserting and Deleting Data

  • What Is A Nested Masterpage In Asp.net 2.0? Can There Be A Master Page Inside A Masterpage?

    When a master page is placed inside the contentplaceholder of a masterpage, then the masterpage is said to be nested. In other words, there is one parent masterpage, and the child masterpage is inside the content placeholder of the parent masterpage.

  • How To Sort The Contents Of A Gridview Control?

    The ASP.NET 2.0 GridView control is a powerful control, the enables sorting of the rows based on a column, all this possible, without writing code. Well thats what we call power.

    The GridView control relies on the underlying data source control to whom this is bound for the sorting capability. The GridView needs to have an AccessDataSource or an SQlDataSource or an ObjectDataSource (if the SortParameterName property is set to a value allowed.

    The AllowSorting property of the GridView control, when set to true, enables sorting of the GridView. A sortable GridView has the Header column represented as a LinkButton control. When this Link Button is clicked, the Sorting event of the GridView is raised server-side, which causes a postback and in turn, sorts the GridView control's records.

  • What Does The Hotspot Class In .net Do? What Is An Imagemap In Asp.net?

    An ImageMap is an ASP.NET control that allows clicks inside a polygon like (called Hotspot) region in a webpage. Well, that actually means you may create a star-shaped or diamond shaped button.

    There are several pre-defined shapes allowed inside an ImageMap for which templates may be used. For example, for a rectangle, an asp:RectangularHotSpot may be used. For a circle, an asp:CircleHotSpot may be used. And for creating stars & diamonds, an asp:PolygonHotSpot may be used. An image may also be put in an ImageMap which may be specified by its ImageUrl property.

    In order to invoke an event, the HotSpotMode property needs to be set to PostBack. Further, if several HotSpots are placed inside an ImageMap, the event of the ImageMap may be passed a value using the PostBackValue property.

    Code below shows how to create a Polygon HotSpot using an ImageMap.

    <asp:ImageMap ID="ImageMap1" Runat="Server"
    ImageUrl="Photo.gif" OnClick="SomeEvent"
    AlternateText="Click Here"
    HotSpotMode="Navigate">

    <asp:PolygonHotSpot
    AlternateText="Click Here Too!"
    Coordinates="100,150, 250,350, 210,290, 90,350, 60,240"
    NavigateUrl="http://www.asp.net"
    Target="_blank"/>
    </asp:ImageMap>

  • How Do We Update And Delete Data In A Gridview? Datakeynames Property In .net?

    The best way to Update or Delete a record in a GridView control is to include a CheckBox column and a Submit Button.

    The GridView has its own Delete and Edit functionality. If the GridView is populated with data using an SqlDataSource, checkout the wizard that comes along with the SqlDataSource. It may be used to automatically create an SQL Delete command and specify the delete parameters.

    The DataKeyNames property of the GridView is set to a field name of the Table.

  • What Is Asp.net?

    ASP.NET is a programming framework built on the common language runtime that can be used on a server to build powerful Web applications.

  • Why Does My Asp.net File Have Multiple Tag With Runat=server?

    This means that ASP.Net is not properly registered with IIS. .Net framework provides an Administration utility that manages the installation and uninstallation of multiple versions of ASP.NET on a single machine. You can find the file in C:\WINNT\Microsoft.NET \Framework\v**\aspnet_regiis.exe
    use the command: aspnet_regiis.exe -u ---> to uninstall current asp.net version.
    use the command: aspnet_regiis.exe -i ---> to install current asp.net version.

    For Windows Server 2003, you must use aspnet_regiis -i -enable This is because of the "Web Service Extensions" feature in IIS 6 (if you install VS.NET or the framework without IIS installed, and then go back in and install IIS afterwards, you have to re-register so that ASP.NET 'hooks' into IIS properly."

  • How To Find Out What Version Of Asp.net I Am Using On My Machine?

    VB.NET
    Response.Write(System.Environment.Version.ToString())

    C#
    Response.Write(System.Environment.Version.ToString());

  • Is It Possible To Pass A Querystring From An .asp Page To Aspx Page?

    Yes you can pass querystring from .asp to ASP.NET page.asp <%response.redirect "webform1.aspx?id=11 " %> .aspx

    VB.NET
    Response.Write (Request("id").ToString())

    C#
    Response.Write (Request["id"].ToString());

  • How To Comment Out Asp.net Tags?

    <%--<asp:Label id="Label1" style="Z-INDEX: 101; LEFT: 8px; POSITION: absolute; TOP: 48px" runat="server"> Label</asp: Label>--%>

  • What Is A Viewstate?

    In classic ASP, when a form is submitted the form values are cleared. In some cases the form is submitted with huge information. In such cases if the server comes back with error, one has to re-enter correct information in the form. But submitting clears up all form values. This happens as the site does not maintain any state (ViewState).

    In ASP.NET, when the form is submitted the form reappears in the browser with all form values. This is because ASP.NET maintains your ViewState. ViewState is a state management technique built in ASP.NET. Its purpose is to keep the state of controls during subsequent postbacks by the same user. The ViewState indicates the status of the page when submitted to the server. The status is defined through a hidden field placed on each page with a <form runat="server"> control.

    <input type="hidden" name= "_VIEWSTATE"  value="dDwyNTA 3OTU0NDM7Oz 7t5Tntzk OUeB0QVV6FT2hvQwtp"  Pw =="/>

    If you want to NOT maintain the ViewState, include the directive <%@ Page Enable View State="false"%> at the top of an .aspx page If you do not want to maintain Viewstate for any control add the attribute Enable View State="false" to any control.

  • Where Can I Get The Details On Migration Of Existing Projects Using Various Technologies To Asp.net?

    Microsoft has designed Migration Assistants to help us convert existing pages and applications to ASP.NET. It does not make the conversion process completely automatic, but it will speed up project by automating some of the steps required for migration. Below are the Code Migration Assistants
    •ASP to ASP.NET Migration Assistant
    •PHP to ASP.NET Migration Assistant
    •JSP to ASP.NET Migration Assistant

  • What Is The Equivalent Of Date() And Time() In Asp.net?

    VB.NET
    System.DateTime.Now.ToShortDateString()
    System.DateTime.Now.ToShortTimeString()

    C#
    System.DateTime.Now.ToShortDateString();
    System.DateTime.Now.ToShortTimeString();

  • How To Prevent A Button From Validating It's Form?

    Set the CauseValidation property of the button control to False.

  • How To Get The Ip Address Of The Host Accessing My Site?

    VB.NET
    Response.Write (Request.UserHostAddress.ToString ())

    C#
    Response.Write (Request.UserHostAddress.ToString ());

  • How To Access The Parameters Passed In Via The Url?

    Call the Request.QueryStringmethod passing in the key. The method will return the parameter value associated with that key. VB.NET
    Request.QueryString("id")

    C#
    Request.QueryString["id"];

  • How To Display A Wait Page While A Query Is Running?

    Refer Asynchronous Wait State Pattern in ASP.NET.

  • How To Implement Form Based Authentication In Asp.net Application?

    For
    •VB.NET
    •C#

  • Is There A Method Similar To Response.redirect That Will Send Variables To The Destination Page Other Than Using A Query String Or The Post Method?

    Server.Transfer preserves the current page context, so that in the target page you can extract values and such. However, it can have side effects; because Server.Transfer doesnt' go through the browser, the browser doesn't update its history and if the user clicks Back, they go to the page previous to the source page.
    Another way to pass values is to use something like a LinkButton. It posts back to the source page, where you can get the values you need, put them in Session, and then use Response.Redirect to transfer to the target page. (This does bounce off the browser.) In the target page you can read the Session values as required.

  • What Are The Differences Between Html Versus Server Control?

    Refer
    •ASP.NET Server Controls Recommendations
    •Introduction to ASP.NET Server Controls

  • How Can I Change The Action Of A Form Through Code?

    You cannot change it. The action attribute is owned by ASP.NET. Handle Events and Transfer.
     

  • Is There Any Control That Allows User To Select A Time From A Clock - In Other Words Is There A Clock Control?

    Peter Blum has developed some controls. Check out Peter's Date Package: TimeOfDayTextBox and Duration Text Box Controls.

  • How To Work With Timespan Class?

    VB.NET
    Dim adate As DateTime = DateTime.Parse("06/24/2003")
    Dim bdate As DateTime = DateTime.Parse("06/28/2003")
    Dim ts As New TimeSpan(bdate.Ticks - adate.Ticks)
    Response.Write(ts.TotalDays & "")
    Response.Write(ts.TotalHours & ":" & ts.TotalMinutes & ":" & ts.Total Seconds & ":" & ts.TotalMilliseconds)

    C#
    DateTime adate = DateTime.Parse("06/24/2003");
    DateTime bdate = DateTime.Parse("06/28/2003");
    TimeSpan ts = new TimeSpan (bdate.Ticks - adate.Ticks);
    Response.Write(ts.TotalDays.ToString () + "");
    Response.Write(ts.TotalHours.ToString() + ":" + ts.Total Minutes. ToString() + ":" + ts.Total Seconds.ToString() + ":" + ts.Total Milli seconds.ToString() );

  • Where Can I Get Information On Cookies In Asp.net?

    Refer Mike Pope's article Basics of Cookies in ASP.NET.

  • Does Asp.net Still Recognize The Global.asa File?

    ASP.Net does not recognize the standard ASP global.asa file. Instead it uses a file named global.asax with the same - plus additional - functionality.

  • How Should I Destroy My Objects In Asp.net?

    ASP.Net actually has very solid internal garbage collection. So this is not an issue as it was in previous versions of Active Server Pages.

  • Are There Resources Online With Tips On Asp To Asp.net Conversions?

    Microsoft has deisnged The ASP to ASP.NET Migration Assistant help us convert ASP pages and applications to ASP.NET. It does not make the conversion process completely automatic, but it will speed up project by automating some of the steps required for migration. The following Code Migration Assistants are discussed in the link below.
    •ASP to ASP.NET Migration Assistant
    •PHP to ASP.NET Migration Assistant
    •JSP to ASP.NET Migration Assistant

  • How Do I Publish My Asp.net Application To My Isp's Web Server?

    Your ISP must first create an IIS application and apply the Front Page Server Extensions to it. Then in Visual Studio.NET, select the "Project | Copy Project" menu. Then enter the URL and select the FrontPage web access method. The "Copy Project" feature copies all of the necessary files to your ISP's machine for your ASP.NET application to run.

    You can also FTP your files to your ISP web server. But you must know which files to upload. 

  • Why Do I Get Error Message "could Not Load Type" Whenever I Browse To My Asp.net Web Site?

    Your code-behind files for either your .aspx or the global.aspx page have not been complied. Use Visual Studio .NET's "Build | Build Solution" menu, or run the command line compiler.

  • Will The Webmatrix Sqldatasourcecontrol Work With A Mysql Connection?

    SqlDataSourceControl lets you connect and work with MS SQL DB, while AccessDataSourceControl do the same thing but for MS Access DB. Therefore SqlDataSourceControl can't help you in your MySql connectivity .
    For Connectivity with MySql refer Accessing MySQL Database with ASP.NET.

  • Can I Combine Classic Asp And Asp.net Pages?

    No.

    ASP pages can run in the same site as ASP.NET pages, but you can't mix in a page. Also ASP and ASP.NET won't share their session.

  • What Is The Difference Between Src And Code-behind?

    Src attribute means you deploy the source code files and everything is compiled JIT (just-in-time) as needed. Many people prefer this since they don't have to manually worry about compiling and messing with dlls -- it just works. Of course, the source is now on the server, for anyone with access to the server -- but not just anyone on the web.

    CodeBehind attribute doesn't really "do" anything, its just a helper for VS.NET to associate the code file with the aspx file. This is necessary since VS.NET automates the pre-compiling that is harder by hand, and therefore the Src attribute is also gone. Now there is only a dll to deploy, no source, so it is certainly better protected, although its always decompilable even then.

  • How Can I Get The Value Of Input Box With Type Hidden In Code-behind?

    You can set the runat= server for the hidden control and you can use ControlName.Value to get its value in CodeBehind file.

  • I Have Created A .net User Control Page (.ascx) But I Cannot Compile And Run It.

    User control (ascx) can't be run on it own, but you can drag it onto any web page (aspx) and then run it.

  • What Is A .resx File?

    The .resx resource file format consists of XML entries, which specify objects and strings inside XML tags. This is useful for localization. 

  • Is It Possible To Use A Style Sheet Class Directly On A Control Instead Of Using Inline Or Page-level Formatting ?

    Every WebControl derived control has a CssClass property which allows you to set it's format to a style sheet.

  • Can I Recieve Both Html Markup For Page And Code In The Asp.net Web Page's Source Code Portion In The Web Browser?

    No.

    The Web browser recieves only HTML markup,No source code or web control syntax is passed back to the web browser.

  • Why Can't I Put <%@ Page Language="c " %> Where At The Top Of An Aspx File And Write My Server-side Scripts In C ?

    The parsers ASP.NET uses to extract code from ASPX files understand C#, Visual Basic.NET, and JScript.NET. You can write server-side scripts in any language supported by a .NET compiler.

  • Asp Pages That Worked Pefectly On Windows 2000 Server And Iis 5.0 Do Not Work On Windows 2003 Server With Iis 6.0. Asp.net Pages Work Fine. Why?

    Start -> Settings -> Control Panel -> Administrative Tools -> and double clicking IIS Manager.
    Go to the Web Service Extensions tab, click Active Server Pages, then press the "Allow" button on the left.

  • Why Do I Get Error Message "error Creating Assembly Manifest: Error Reading Key File 'key.snk' -- The System Cannot Find The File Specified"?

    Check the location of the key.snk file relative to the assembly file. Provide an explicit path or a relative path.
    <Assembly: AssemblyKeyFileAttribute("Drive:\key.snk")>

  • How To Get Url Without Querystring?

    VB.NET
    Dim stringUri As String = "http://www.syncfusion.com/?id=1&auid=16" Dim weburi As Uri = New Uri(stringUri)
    Dim query As String = weburi.Query
    Dim weburl As String = stringUri.Substring(0, stringUri.Length - query.Length)
    Response.Write(weburl)

    C#
    string stringUri = "http://www.syncfusion.com/?id=1&auid=16"; Uri weburi = new Uri(stringUri);
    string query = weburi.Query;
    string weburl = stringUri.Substring(0, stringUri.Length - query.Length);
    Response.Write (weburl);

  • What Is The Best Way To Output Only Time And Not Date?

    Use DateTime as follows VB.NET
    Response.Write(DateTime.Now.ToString("hh:mm:ss"))

    C#
    Response.Write(DateTime.Now.ToString("hh:mm:ss"));

  • Do I Have To Compile Code If I Am Changing The Content Of My Aspx.cs File?

    Yes if you have used Codebehind="my.aspx.cs".

    if not  you used src="my.aspx.cs" in your page declaration.

  • How To Grab The Referring Url?

    VB.NET
    Response.Write ( Request.UrlReferrer.ToString())

    C#
    Response.Write ( Request.UrlReferrer.ToString());

  • My Asp Code Gives An Error "compiler Error Message: Bc30289: Statement Cannot Appear Within A Method Body. End Of Method Assumed" When Changed To .aspx?

    Use a <script runat="server" type="text/javascript"> block instead of the <% %> syntax to define Subs.Make sure you have proper events associated with the code and have start and end of procedure or function wirtten properly.

  • How Can I Save Images ?

    You need a stream to read the response, WebResponse. GetResponse Stream(), and a stream to write it to the hard drive. FileStream should do the trick. You'll have to write to the filestream what you read from the response stream.

  • How Can I Logout When Using Formsauthentication?

    FormsAuthentication.SignOut().

  • Why Do I Get A Blank Page When I Use Server.transfer("page1.htm") To Transfer To A Different Page?

    Server.Transfer only works with .aspx pages You can't use Transfer method with HTML pages.

  • How To Detect The User's Culture?

    VB.NET
    Dim sLang As String
    sLang = Request.UserLanguages(0)
    Response.Write(sLang)

    C#
    string sLang ;
    sLang = Request.UserLanguages[0];
    Response.Write (sLang);

  • What Is The Difference Between Currentculture Property And The Currentuiculture Property?

    • CurrentCulture property : affects how the .NET Framework handles dates, currencies, sorting and formatting issues.
    • CurrentUICulture property : determines which satellite assembly is used when loading resources.
  • Can I Read The Hard Disk Serial # Of The Client Computer Using Asp.net?

    No.

    Such information is not passed to the server with a http request.

  • What Is Xxx(src As Object, E As Eventargs)?

    xxx is an event handler src is the object that fires the event e is an event argument object that contains more information about the event An event handler is used when one object wants to be notified when an event happens in another object.

  • What Is The Difference Between Absolute Vs Relative Urls?

    Absolute /Fully Qualified URLs:

    • Contain all information necessary for the browser(or other client program) to locate the resource named in the URL
      • This includes protocol monitor used( i.e http://, ftp://..etc..), Server's Domain name or IP address and the file path
      • Absolute URL looks as http://localhost/megasolutions/page1.aspx Relative URLs:
    • Only provide information necessary to locate a resourcerelative to the current document(document relative) or current server or domain(root relative)
      • Document relative URL - page1.aspx
      • Root Relative URL - /megasolutions/Admin/pagelog.aspx
  • What Is The Difference Between Url And Uri?

    A URL is the address of some resource on the Web, which means that normally you type the address into a browser and you get something back. There are other type of resources than Web pages, but that's the easiest conceptually. The browser goes out somewhere on the Internet and accesses something.

    A URI is just a unique string that uniquely identifies something, commonly a namespace. Sometimes they look like a URL that you could type into the address bar of your Web browser, but it doesn't have to point to any physical resource on the Web. It is just a unique set of characters, that, in fact, don't even have to be unique.

    URI is the more generic term, and a URL is a particular type of URI in that a URL has to uniquely identify some resource on the Web.

  • How To Convert Milliseconds Into Time?

    VB.NET
    dim ts as TimeSpan = TimeSpan.FromMilliseconds(10000) Response.Write (ts.ToString ())

    C#
    TimeSpan ts = TimeSpan.FromMilliseconds(10000);
    Response.Write (ts.ToString ());

  • How To Include Multiple Vb/cs Files In The Source?

    You can do this using assembly directives.
    <%@ assembly src="test1.vb" %>
    <%@ assembly src="test2.vb" %>
    or
    <%@ assembly src="test1.cs" %>
    <%@ assembly src="test2.cs" %>

    However, note that each source file will be compiled individually into its own assembly, so they cannot have dependencies on each other.

  • How To Convert A String To Proper Case?

    Use the namespace System.Globalization.VB.NET
    Dim myString As String = "syncFusion deVeloPer sUppOrt" 'Creates a TextInfo based on the "en-US" culture.
    Dim TI As TextInfo = New CultureInfo("en-US", False).TextInfo
    Response.Write(TI.ToTitleCase(myString))

    C#
    string myString = "syncFusion deVeloPer sUppOrt";
    // Creates a TextInfo based on the "en-US" culture.
    TextInfo TI = new CultureInfo("en-US",false).TextInfo;
    Response.Write (TI.ToTitleCase( myString ));

  • How Can I Ensure That Application-level Variables Are Not Updated By More Than One User Simultaneously?

    Use the HttpApplicationState's Lock and UnLock methods.

  • Why Do I Get The Error Message "system.invalidoperationexception: It Is Invalid To Show A Modal Dialog Or Form When The Application Is Not Running In Userinteractive Mode. Specify The Servicenotification Or Defaultdesktoponly Style To Display A ...."?

    You can't use MsgBox or MessageBox.Show in ASP.NET WebForm. You maybe use:
    VB.NET
    Response.Write("<script>alert('Hello');</script>")

    C#
    Response.Write("<script>alert('Hello');</script>");

  • How To Validate That A String Is A Valid Date?

    VB.NET
    Dim blnValid As Boolean = False
    Try
    DateTime.Parse(MyString)
    blnValid = True
    Catch
    blnValid = False
    End Try

    C#
    bool blnValid=false;
    try
    {
    DateTime.Parse(MyString);
    blnValid=true;
    }
    catch
    {
    blnValid=false;
    }

  • Are Namespaces And Class Names Are Case Sensitive?

    Namespaces and Class names are case Sensitive. Namespaces imported using the @ Import Directive will cause an error if the correct case is not used.

  • How To Get The Url Of Page Dynamically?

    Use Request.Url property.

  • How To Convert User Input In Dmy Format To Mdy?

    VB.NET
    Dim dt As DateTime = DateTime.ParseExact("0299", New String() {"My", "M/y"}, Nothing, System. Globalization. Date Time Styles.None)

    C#
    DateTime dt = DateTime.ParseExact("0299", new string[] {"My","M/y"}, null,System. Globalization. Date Time Styles.None);

  • When The User Is Prompted A File Download Dialogbox, If The User Selects "save" Then The "save As" Dialog Box Is Displayed. Is There Any Way For Me To Retrieve The Filename And Directory Path Specified By The User On The File Download Dialog Box?

    Clients do not report information back about where the user selects to save the content, so there isn't an easy way to do this. Instead, you would need to ask the user before using the content-disposition for a file path, and then you could specify the filename parameter for the content-disposition header. Still, the user is free to change that path when actually downloading.

  • How To Hide Or Show Controls In Server Side Code?

    In any appropriate event write
    VB.NET
    TextBox1.Visible =not TextBox1.Visible

    C#
    TextBox1.Visible =!TextBox1.Visible;

  • How To Check If The User Is Using A Secure Or Non Secure Connection?

    The Request Object defines a Property called IsSecureConnection, that will indicate whether http:// or https:// has been used.

  • Is It Possible To Write Code In Many Languages In One Asp.net Project?

    You cannot write the code-behind files in different languages in the same project, but you can write the aspx pages and ascx controls in different languages.

  • What Is The Difference Between Response.redirect() And Server.transfer().

    Response.Redirect

    • Tranfers the page control to the other page, in other words it sends the request to the other page.
    • Causes the client to navigate to the page you are redirecting to. In http terms it sends a 302 response to the client, and the client goes where it's told.

    Server.Transfer

    • Only transfers the execution to another page and during this you will see the URL of the old page since only execution is transfered to new page and not control.
    • Occurs entirely on the server, no action is needed by the client Sometimes for performance reasons, the server method is more desirable
  • How To Get The Hostname Or Ip Address Of The Server?

    You can use either of these:

    • HttpContext.Current.Server.MachineName
    • HttpContext.Current.Request.ServerVariables["LOCAL_ADDR"]

    The first one should return the name of the machine, the second returns the local ip address.

    Note: that name of the machine could be different than host, since your site could be using host headers.

  • What Is The Meaning Of Validaterequest=true In .net Framework1.1?

    The value of validateRequest is set to 'true' by default, which means that the framework will automatically deny submission of the '<'and'>' characters.

  • What Is The Different Between <%# %> And <%= %>?

    The <%# %> is used for databinding where as <%= %> is used to output the result of an expression. The expression inside <%# %> will be executed only when you call the page's or control's DataBind method. The expression inside <%= %> will be executed and displayed as and when it appears in the page.

  • What Permissions Do Asp.net Applications Posses By Default?

    By default ASP.NET Web applications run as ASP.NET user. This user has limited permissions equivalent to the User Group.

  • How Can I Specify The Relative Path For A File?

    Suppose you have following file hierarchy:

    default.aspx
    Admin/login.aspx
    Misc/testpage.aspx

    And you are on the login.aspx and want your user to navigate to the default.aspx (or testpage.aspx) file. Then you can use

    • Response.Redirect ("../default.aspx").
    • Response.Redirect ("../Misc/testpage.aspx").
  • How Can I Specify The "upload A File" Input Textbox In A Form To Be Read Only So That The User Can Click On The Browse Button And Pick A File But They Cannot Type Anything Into The Textbox Next To The Browse Button.

    <input id="File1" type="file" contenteditable=false/>

  • How To Change The Page Title Dynamically?

    <TITLE id="Title1" runat =server></TITLE>

    VB.NET
    'Declare Protected WithEvents Title1 As System.Web.UI.HtmlControls. HtmlGenericControl
    'In Page_Load Title1.InnerText ="Page 1"

    C#
    //Declare protected System.Web.UI.HtmlControls.HtmlGenericControl Title1 ;
    //In Page_Load Title1.InnerText ="Page 1" ;

  • Why Do I Get The Error Message "object Must Implement Iconvertible". How Can I Resolve It?

    The common cause for this error is specifying a control as a SqlParameter's Value instead of the control's text value.For example, if you write code as below you'll get the above error:

    VB.NET

    Dim nameParameter As SqlParameter = command.Parameters.Add ("@name",SqlDbType.NVarChar,50)
    nameParameter.Value = txtName

    C#

    SqlParameter nameParameter = command.Parameters.Add("@name", SqlDbType.NVarChar, 50);
    nameParameter.Value = txtName ;

    To resolve it, specify the control's Text property instead of the control itself.

    VB.NET

    nameParameter.Value = txtName.Text

    C#

    nameParameter.Value =txtName.Text;

  • Why Is Default.aspx Page Not Opened If I Specify Http://localhost. I Am Able To View This Page If I Hardcode It As Http://localhost/default.aspx?

    If some other default page comes higher in the list, adjust the default.aspx to be the number one entry inside the IIS configuration. If you have multiple websites inside IIS, make sure the configuration is applied on the right website (or on all websites by applying the configuration on the server-level using the properties dialog, configure WWW service).

  • Can Asp.net Work On An Nt Server?

    No.

    For more details refer ASP 1.1 version.

  • Is It Possible To Migrate Visual Interdev Design-time Controls To Asp.net?

    In VS.NET you can go to Tools > Options > Source Control > General and check the checkbox for Get everything when a solution opens. This retrieves the latest version of all solution items when you open the solution.

  • How To Automatically Get The Latest Version Of All The Asp.net Solution Items From Source Safe When Opening The Solution?

    In VS.NET you can go to Tools > Options > Source Control > General and check the checkbox for Get everything when a solution opens.This retrieves the latest version of all solution items when you open the solution.

  • How To Make Vs.net Use Flowlayout As The Default Layout Rather Than The Gridlayout?

    For VB.NET, go to path C:Program Files Microsoft Visual Studio .NET Vb7 VBWizards WebForm Templates 1033

    Change the following line in the existing WebForm1.aspx

    <body MS_POSITIONING="[!output DEFAULT_HTML_LAYOUT]">to

    For C#, go to path C: Program Files Microsoft Visual Studio .NET 2003 VC# VC# Wizards CSharp WebApp Wiz Templates 1033

    Change the following line in the existing WebForm1.aspx

    <body MS_POSITIONING="[!output DEFAULT_HTML_LAYOUT]">to

    Note:Before changing any templates it's a good idea to make backup copies of them Or rather than above approach you can change the behavior for new files on a per project basis in Visual Studio by:

    1. Right clicking on the project name (Ex: "WebApplication1)" in Solution Explorer, and select "Properties".
    2. From project properties window, under Common Properties>Designer Defaults>Page Layout change "Grid" to "Flow".
  • Can I Use A Datareader To Update/insert/delete A Record?

    No.

    DataReader provides a means of reading a forward-only stream of rows from a database.

  • How To Format A Telphone Number In The Xxx-xxx-xxxx Format?

    VB.NET

    Dim Telno As Double = Double.Parse(ds.Tables(0).Rows(0)("TelNo"). ToString())
    Response.Write(Telno.ToString("###-###-####"))

    C#

    double Telno= double.Parse(ds.Tables[0].Rows[0]["TelNo"]. ToString());
    Response.Write(Telno.ToString("###-###-####"));

  • Can Two Different Programming Languages Be Mixed In A Single Aspx File?

    No.

    ASP.NET uses parsers to strip the code from ASPX files and copy it to temporary files containing derived Page classes, and a given parser understands only one language.

  • Can I Use Custom .net Data Types In A Web Form?

    Yes.

    Place the DLL containing the type in the application root's bin directory and ASP.NET will automatically load the DLL when the type is referenced. This is also what happens when you add a custom control from the toolbox to your web form.

  • How Can I Have A Particular Web Page In An Asp.net Application Which Displays Its Own Error Page?

    This can be done by setting the ErroPage attribute of Page Directive or ErrorPage property of Page Class to the desired Custom Error Page

    <%@Page Language="C#" ErrorPage="specificerropage.htm"%>

    In web.config

    <customErrors mode="On" />

  • Describe The Role Of Inetinfo.exe, Aspnet_isapi.dll And Aspnet_wp.exe In The Page Loading Process?

    inetinfo.exe is theMicrosoft IIS server running, handling ASP.NET requests among other things.When an ASP.NET request is received (usually a file with .aspx extension), the ISAPI filter aspnet_isapi.dll takes care of it by passing the request to the actual worker process aspnet_wp.exe.

  • What's The Difference Between Response.write() Andresponse.output.write()?

    Response.Output.Write() allows you to write formatted output.

  • What Methods Are Fired During The Page Load?

    • Init()-when the page is instantiated.
    • Load()-when the page is loaded into server memory.
    • PreRender()-the brief moment before the page is displayed to the user as HTML.
    • Unload()-when page finishes loading.
  • When During The Page Processing Cycle Is Viewstate Available?

    After the Init() and before the Page_Load(), or OnLoad() for a control.

  • What Namespace Does The Web Page Belong In The .net Framework Class Hierarchy?

    System.Web.UI.Page
  • Where Do You Store The Information About The User's Locale?

    System.Web.UI.Page.Culture

  • What's The Difference Between Codebehind="mycode.aspx.cs" Andsrc="mycode.aspx.cs"?

    CodeBehind is relevant to Visual Studio.NET only.

  • What's A Bubbled Event?

    When you have a complex control, like DataGrid, writing an event processing routine for each object (cell, button, row, etc.) is quite tedious. The controls can bubble up their eventhandlers, allowing the main DataGrid event handler to take care of its constituents.

  • Suppose You Want A Certain Asp.net Function Executed On Mouseover For A Certain Button. Where Do You Add An Event Handler?

    Add an OnMouseOver attribute to the button.

    Example: btnSubmit.Attributes.Add ("onmouseover","someClient CodeHere();");

  • What Data Types Do The Rangevalidator Control Support?

    Integer, String, and Date.

  • Explain The Differences Between Server-side And Client-side Code?

    Server-side code executes on the server. Client-side code executes in the client's browser.

  • What Type Of Code (server Or Client) Is Found In A Code-behind Class?

    The answer is server-side code since code-behind is executed on the server. However, during the code-behind's execution on the server, it can render client-side code such as JavaScript to be processed in the clients browser. But just to be clear, code-behind executes on the server, thus making it server-side code.

  • Should User Input Data Validation Occur Server-side Or Client-side? Why?

    All user input data validation should occur on the server at a minimum. Additionally, client-side validation can be performed where deemed appropriate and feasable to provide a richer, more responsive experience for the user.

  • What Is The Difference Between Server.transfer And Response.redirect? Why Would I Choose One Over The Other?

    Server.Transfer transfers page processing from one page directly to the next page without making a round-trip back to the client's browser. This provides a faster response with a little less overhead on the server. Server.Transfer does not update the clients url history list or current url. Response.Redirect is used to redirect the user's browser to another page or site. This perform as a trip back to the client where the client's browser is redirected to the new page. The user's browser history list is updated to reflect the new address.

  • Can You Explain The Difference Between An Ado.net Dataset And An Ado Recordset?

    Valid answers are:

    • A DataSet can represent an entire relational database in memory, complete with tables, relations, and views.
    • A DataSet is designed to work without any continuing connection to the original data source.
    • Data in a DataSet is bulk-loaded, rather than being loaded on demand.

    There's no concept of cursor types in a DataSet.

    • DataSets have no current record pointer You can use For Each loops to move through the data.
    • You can store many edits in a DataSet, and write them to the original data source in a single operation.
    • Though the DataSet is universal, other objects in ADO.NET come in different versions for different data sources.
  • What Is The Global.asax Used For?

    The Global.asax (including the Global.asax.cs file) is used to implement application and session level events.

  • What Are The Application_start And Session_start Subroutines Used For?

    This is where you can set the specific variables for the Application and Session objects.

  • Can You Explain What Inheritance Is And An Example Of When You Might Use It?

    When you want to inherit (use the functionality of) another class.Example: With a base class named Employee, a Manager class could be derived from the Employee base class.

  • Whats An Assembly?

    Assemblies are the building blocks of the .NET framework. Overview of assemblies from MSDN.

  • Describe The Difference Between Inline And Code Behind?

    Inline code is written along with the html code in a page. Code-behind is code written in a separate file and referenced by the .aspx page.

  • Explain What A Diffgram Is, And A Good Use For One?

    The DiffGram is one of the two XML formats that you can use to render DataSet object contents to XML. A good use is reading database data to an XML file to be sent to a Web Service.

  • What Is Msil, And Why Should My Developers Need An Appreciation Of It If At All?

    MSIL is the Microsoft Intermediate Language. All .NET compatible languages will get converted to MSIL. MSIL also allows the .NET Framework to JIT compile the assembly on the installed computer.

  • Which Method Do You Invoke On The Dataadapter Control To Load Your Generated Dataset With Data?

    The Fill() method.

  • Can You Edit Data In The Repeater Control?

    No,

    it just reads the information from its data source.

  • Which Template Must You Provide, In Order To Display Data In A Repeater Control?

    ItemTemplate.

  • How Can You Provide An Alternating Color Scheme In A Repeater Control?

    Use the AlternatingItemTemplate.

  • What Property Must You Set, And What Method Must You Call In Your Code, In Order To Bind The Data From A Data Source To The Repeater Control?

    You must set the DataSource property and call the DataBind method.

  • What Base Class Do All Web Forms Inherit From?

    The Page class.

  • Name Two Properties Common In Every Validation Control?

    • ControlToValidate property and,
    • Text property.
  • Which Property On A Combo Box Do You Set With A Column Name, Prior To Setting The Datasource, To Display Data In The Combo Box?

    DataTextField property.

  • Which Control Would You Use If You Needed To Make Sure The Values In Two Different Controls Matched?

    CompareValidator control.

  • How Many Classes Can A Single .net Dll Contain?

    It can contain many classes.

  • What Is The Transport Protocol You Use To Call A Web Service?

    SOAP(Simple Object Access Protocol) is the preferred protocol.

  • What Does Wsdl Stand For?

    Web Services Description Language.

  • Where On The Internet Would You Look For Web Services?

    http://www.uddi.org

  • To Test A Web Service You Must Create A Windows Application Or Web Application To Consume This Service?

    False,

    The web service comes with a test page and it provides HTTP-GET method to test.

  • Can You Give An Example Of When It Would Be Appropriate To Use A Web Service As Opposed To A Non-serviced .net Component?

    Webservice is one of main component in Service Oriented Architecture. You could use webservices when your clients and servers are running on different networks and also different platforms. This provides a loosely coupled system. And also if the client is behind the firewall it would be easy to use webserivce since it runs on port 80 (by default) instead of having some thing else in SOA apps.

  • What Is Viewstate?

    ViewState allows the state of objects (serializable) to be stored in a hidden field on the page. ViewState is transported to the client and back to the server, and is not stored on the server or any other external source. ViewState is used the retain the state of server-side objects between postbacks.

  • What Is The Lifespan For Items Stored In Viewstate?

    Item stored in ViewState exist for the life of the current page. This includes postbacks (to the same page).

  • What Does The "enableviewstate" Property Do? Why Would I Want It On Or Off?

    It allows the page to save the users input on a form across postbacks. It saves the server-side values for a given control into ViewState, which is stored as a hidden value on the page before sending the page to the clients browser. When the page is posted back to the server the server control is recreated with the state stored in viewstate.

  • What Are The Different Types Of Session State Management Options Available With Asp.net?

    ASP.NET provides In-Process and Out-of-Process state management.

    In-Process stores the session in memory on the web server. This requires the a "sticky-server" (or no load-balancing) so that the user is always re connected to the same web server.

    Out-of-Process Session state management stores data in an external data source. The external data source may be either a SQL Server or a State Server service. Out-of-Process state management requires that all objects stored in session are serializable.

  • Let's Say I Have An Existing Application Written Using Visual Studio 6 (vb 6, Interdev 6) And This Application Utilizes Windows 2000 Com+ Transaction Services. How Would You Approach Migrating This Application To .net

    You have to use System.EnterpriseServices namespace and also COMInterop the existing application.

  • Can You Give An Example Of What Might Be Best Suited To Place In The Application_start And Session_start Subroutines?

    In the Application_Start event you could store the data, which is used throughout the life time of an application for example application name, where as Session_Start could be used to store the information, which is required for that session of the application say for example user id or user name.

  • If Iam Developing An Application That Must Accomodate Multiple Security Levels Though Secure Login And My Asp.net Web Appplication Is Spanned Across Three Web-servers (using Round-robbin Load Balancing) What Would Be The Best Approach To Maintain Login-in State For The Users?

    Use the state server or store the state in the database. This can be easily done through simple setting change in the web.config.

    <sessionState mode="InProc" stateConnection String= "tcpip=127.0.0. 1:42424" sqlConnectionString="data source=127.0.0.1;user id=sa; password=" cookieless="false" timeout="30"/>

    in the above one instead of mode="InProc", you specifiy stateserver or sqlserver.

  • What Are Asp.net Web Forms? How Is This Technology Different Than What Is Available Though Asp (1.0-3.0)?

    ASP.NET webforms are analogous to Windows Forms which are available to most VB developers. A webform is essentially a core container in a Page. An empty webform is nothing but a HTML Form tag(control) running at server and posting form to itself by default, but you could change it to post it to something else. This is a container, and you could place the web controls, user controls and HTML Controls in that one and interact with user on a postback basis.

  • How Does Vb.net/c# Achieve Polymorphism?

    Polymorphism is achieved through virtual, overloaded, overridden methods in C# and VB.NET.

  • Describe Session Handling In A Webform, How Does It Work And What Are The Its Limits?

    Sometimes it is necessary to carry a particular session data across pages, and HTTP is a stateless protocol. In order to maintain state between page calls, we could use cookies, hidden form fields etc. One of them is using sessions. each sessions are maintain a unique key on the server and serialize the data on it. Actually it is a hashtable and stores data on key/value pair of combination. You could set a session using Session Object and retrieve the same data/state by passing the key.

    //Set
    Session["abc"] = "Session Value";

    // Get
    string abc = Session["abc"].ToString();

    The downside of sessions is scalability. Say your application gets more and more hits and you though instead of one webserver handling it, have it in a webform (multiple web servers working under one domain). You cannot transfer the session so easily across multiple webservers. it physically serializes the state data to webserver hard disk. .NET proposes a new way to handle this using a stateserver (actually a trimmed down sql server) storing the web session data in a factory configured database schema or using Database with your own schema defined to handle the sessions.

  • How Would You Get Asp.net Running In Apache Web Servers - Why Would You Even Do This?

    You need to create a CLRHost, which hosts the CLR (ASP.NET) on top of Apache. Since Apache is #1 webserver used by many companies, this would allow more number of web site owners to take advantage of ASP.NET and its richness.

  • In What Order Do The Events Of An Aspx Page Execute. As A Developer Is It Important To Undertsand These Events?

    This is the order of Page events

    • Page_Init
    • Page_LoadViewState
    • Page_LoadPostData
    • Page_Load
    • Page_RaisePostDataChanged
    • Page_RaisePostBackEvent
    • Page_PreRender
    • Page_SaveViewState
    • Page_Render
    • Page_Dispose
    • Page_Error(this is caused whenever there is an exception at the page level).

    Out of all the Page_Load is the one where your code gets loaded and your magic should be written. page_init occurs only once, i.e. when the page is initially created.

    As a developer you need to know these, becuase your development activity is coding for these only.

  • What Method Do You Use To Explicitly Kill A User's Session?

    Session.Abandon()

  • How Do You Turn Off Cookies For One Page In Your Site?

    Actually I never did this. But there should be a way to do this. May be need to write your own code to do this using Response. Cookies collection and HTTPCookie class and also SessionStateMode. Or there may be some simple way to do it. Need to do further research on this.

  • Which Two Properties Are On Every Validation Control?

    The common properties are:

    • IsValid (bool)
    • ControlToValidate (string)
    • ErrorMessage (string)
    • ValidationDisplay (Display)
    • Text (string)

    The common method is:Validate().

  • What Tags Do You Need To Add Within The Asp:datagrid Tags To Bind Columns Manually?

    You need to set AutoGenerateColumns Property to false.

  • How Do You Create A Permanent Cookie?

    If you are developing web services and the cookies need to be travelled across multiple requests, then it need to have permanent or persistant cookie. In order to do this, you have to set  your webserivce CookieContainer to a newly created Cookie Container, and set  its cookie to a session value and then store the cookie(s) into the Service CookieCollection from that cookie container if something is there otherwise add cookie to the container.

  • What Tag Do You Use To Add A Hyperlink Column To The Datagrid?

    HyperLinkColumn.

  • What Is The Standard You Use To Wrap Up A Call To A Web Service?

    SOAP.

  • Which Method Do You Use To Redirect The User To Another Page Without Performing A Round Trip To The Client?

    Server.Transfer.

    Response.Redirect also does that but it requires round trip between client and server.

  • A Web Service Can Only Be Written In .net?

    False.

  • What Property Do You Have To Set To Tell The Grid Which Page To Go When Using The Pager Object?

    CurrentPageIndex.

    You need to set this one with the DataGridPageChangedEventArgs' NewPageIndex.

  • Why Would You Use An Array Vs Linked-list ?

    Linked List:

    • They allow a new element to be inserted or deleted at any position in a constant number of operations (changing some references) O(1).
    • Easy to delete a node (as it only has to rearrange the links to the different nodes)., O(1).
    • To find the nth node, will need to recurse through the list till it finds [linked lists allow only sequential access to elements. ], O(n)

    Array

    • Insertion or deletion of element at any position require a linear (O(n)) number of operations.
    • Poor at deleting nodes (or elements) as it cannot remove one node without individually shifting all the elements up the list by one., O(n)
    • Poor at inserting as an array will eventually either fill up or need to be resized, an expensive operation that may not even be possible if memory is fragmented. Similarly, an array from which many elements are removed may become wastefully empty or need to be made smaller, O(n)
    • easy to find the nth element in the array by directly referencing them by their position in the array.[ arrays allow random access ] , O(1)
  • What I Need To Create And Run An Asp.net Application?

    Windows 2000, Windows Server 2003 or Windows XP.

    ASP.NET, which can be either the redistributable (included in the .NET SDK) or Visual Studio .NET.

  • Are There Any Free Ides For The .net Sdk?

    Microsoft provides Visual Studio 2005 Express Edition Beta for free. Of particular interest to the ASP.NET developers would be the Visual Web Developer 2005 Express Edition Beta 2 available as a free download.

    The ASP.NET Web Matrix Project (supported by Microsoft) is a free IDE for developing ASP.NET applications and is available here.

    There is also a free open-source UNIX version of the Microsoft .NET development platform called Mono available for download here.

    Another increasingly popular Open Source Development Environment for .NET is the #develop (short for SharpDevelop) available for download here.

  • Where Can I Download The .net Sdk?

    .NET SDK can be obtained here.

    (You have to install the Microsoft .NET Framework Version 1.1 Redistributable Package before installing the .NET SDK.)

  • When Was Asp.net Released?

    ASP.NET is a part of the .NET framework which was released as a software platform in 2002.

  • Is A New Version Coming Up?

    ASP.NET 2.0, Visual Studio 2005 (Whidbey), Visual Web Developer 2005 Express Edition are the next releases of Microsoft's Web platform and tools. They have already been released as Beta versions. They are scheduled to be released in the week of November 7, 2005.

  • Explain Namespace?

    Namespaces are logical groupings of names used within a program. There may be multiple namespaces in a single application code, grouped based on the identifier's use. The name of any given identifier must appear only once in its namespace.

  • List The Types Of Authentication Supported By Asp.net?

    • Windows(default),
    • Forms,
    • Passport,
    • None(Security disabled).
  • What Is Clr?

    Common Language Runtime (CLR) is a run-time environment that manages the execution of .NET code and provides services like memory management, debugging, security, etc. The CLR is also known as Virtual Execution System (VES).

  • What Is Cli?

    The CLI is a set of specifications for a runtime environment, including a common type system, base class library, and a machine-independent intermediate code known as the Common Intermediate Language (CIL). (Source: Wikipedia).

  • List The Various Stages Of Page-load Lifecycle?

    • Init(),
    • Load(),
    • PreRender(),
    • Unload().
  • Explain Assembly And Manifest?

    An assembly is a collection of one or more files and one of them (DLL or EXE) contains a special metadata called Assembly Manifest. The manifest is stored as binary data and contains details like versioning requirements for the assembly, the author, security permissions, and list of files forming the assembly. An assembly is created whenever a DLL is built. The manifest can be viewed programmatically by making use of classes from the System. Reflection namespace. The tool Intermediate Language Disassembler (ILDASM) can be used for this purpose. It can be launched from the command prompt or via Start> Run.

  • What Is Shadow Copy?

    In order to replace a COM component on a live dedicated server, it was necessary to stop the entire website, copy the new files and then restart the website. This is not feasible for the web servers that need to be always running. .NET components are different. They can be overwritten at any time using a mechanism called Shadow Copy. It prevents the Portable Executable (PE) files like DLLs and EXE's from being locked. Whenever new versions of the PE's are released, they are automatically detected by the CLR and the changed components will be automatically loaded. They will be used to process all new requests not currently executing, while the older version still runs the currently executing requests. By bleeding out the older version, the update is completed.

  • What Is Dll Hell?

    DLL hell is the problem that occurs when an installation of a newer application might break or hinder other applications as newer DLLs are copied into the system and the older applications do not support or are not compatible with them, .NET overcomes this problem by supporting multiple versions of an assembly at any given time. This is also called side-by-side component versioning.

  • Explain Web Services?

    Web services are programmable business logic components that provide access to functionality through the Internet. Standard protocols like HTTP can be used to access them. Web services are based on the Simple Object Access Protocol (SOAP), which is an application of XML. Web services are given the .asmx extension.

  • Explain Windows Forms?

    Windows Forms is employed for developing Windows GUI applications. It is a class library that gives developers access to Windows Common Controls with rich functionality. It is a common GUI library for all the languages supported by the .NET Framework.

  • What Is Postback?

    PostBack is the name given to the process of submitting an ASP.NET page to the server for processing. PostBack is done if certain credentials of the page are to be checked against some sources (such as verification of username and password using database). This is something that a client machine is not able to accomplish and thus these details have to be 'posted back' to the server.

  • Enumerate The Types Of Directives?

    • @Page directive,
    • @Import directive,
    • @Implements directive,
    • @Register directive,
    • @Assembly directive,
    • @OutputCache directive,
    • @Reference directive.
  • What Is Code-behind?

    Code-Behind is a concept where the contents of a page are in one file and the server-side code is in another page. This allows different people to work on the same page at the same time and also allows either part of the page to be easily redesigned, with no changes required in the other. An Inherits attribute is added to the @ Page directive to specify the location of the Code-Behind file to the ASP.NET page.

  • List The Asp.net Validation Controls?

    • RequiredFieldValidator,
    • RangeValidator,
    • CompareValidator,
    • RegularExpressionValidator,
    • CustomValidator,
    • ValidationSummary.
  • What Is Data Binding?

    Data binding is a way used to connect values from a collection of data (e.g. DataSet) to the controls on a web form. The values from the dataset are automatically displayed in the controls without having to write separate code to display them.

  • Describe Paging In Asp.net?

    The DataGrid control in ASP.NET enables easy paging of the data. The AllowPaging property of the DataGrid can be set to True to perform paging, ASP.NET automatically performs paging and provides the hyperlinks to the other pages in different styles, based on the property that has been set for PagerStyle.Mode.

  • What Is The Difference Between Server.transfer And Response.redirect?

    Response.Redirect: This tells the browser that the requested page can be found at a new location. The browser then initiates another request to the new page loading its contents in the browser. This results in two requests by the browser.

    Server.Transfer: It transfers execution from the first page to the second page on the server. As far as the browser client is concerned, it made one request and the initial page is the one responding with content. The benefit of this approach is one less round trip to the server from the client browser. Also, any posted form variables and query string parameters are available to the second page as well.

  • What Is Rdbms?

    Relational Data Base Management Systems (RDBMS) are database management systems that maintain data records and indices in tables. Relationships may be created and maintained across and among the data and tables. In a relational database, relationships between data items are expressed by means of tables. Inter dependencies among these tables are expressed by data values rather than by pointers. This allows a high degree of data independence. An RDBMS has the capability to recombine the data items from different files, providing powerful tools for data usage.

  • What Are The Properties Of The Relational Tables?

    Relational tables have six properties:

    • Values are atomic.
    • Column values are of the same kind.
    • Each row is unique.
    • The sequence of columns is insignificant.
    • The sequence of rows is insignificant.
    • Each column must have a unique name.
  • What Is Normalization?

    Database normalization is a data design and organization process applied to data structures based on rules that help building rlational databases. In relational database design, the process of organizing data to minimize redundancy is called normalization. Normalization usually involves dividing a database into two or more tables and defining relationships between the tables. The objective is to isolate data so that additions, deletions, and modifications of a field can be made in just one table and then propagated through the rest of the database via the define relationships.

  • What Is De-normalization?

    De‐normalization is the process of attempting to optimize the performance of a database by adding redundant data. It is sometimes necessary because current DBMS's implement the relational model poorly. A true relational DBMS would allow for a fully normalized database at the logical level, while providing physical storage of data that is tuned for high performance. De‐normalization is a technique to move from higher to lower normal forms of database modeling in order to speed up database access.

  • What Are Different Normalization Forms?

    1NF:Eliminate Repeating Groups

    Make a separate table for each set of related attributes,and give each table a primary key.Each field contains at most one value from its attribute domain.

    2NF:Eliminate Redundant Data

    If an attribute depends on only part of a multi‐valued key, remove it to a separate table.

    3NF:Eliminate Columns Not Dependent On Key

    If attributes do not contribute to a description of the key, remove them to a separate table. All attributes must be directly dependent on the primary key.

    BCNF:Boyce‐Codd Normal Form

    If there are non‐trivial dependencies between candidate key attributes,separate them out into distinct tables.

    4NF:Isolate Independent Multiple Relationships

    No table may contain two or more 1:n or n:m relationships that are not directly related.

    5NF:Isolate Semantically Related Multiple Relationships:

    There may be practical constrains on information that justify separating logically related many‐to‐many relationships.

    ONF:Optimal Normal Form

    A model limited to only simple(elemental) facts,as expressed in Object Role Model notation.

  • What Is Stored Procedure?

    A stored procedure is a named group of SQL statements that have been previously created and stored in the server database. Stored procedures accept input parameters so that a single procedure can be used over the network by several clients using diferent input data and when the procedure is modified, all clients automatically get the new version. Stored procedures reduce network traffic and improve performance. Stored procedures can be used to help ensure the integrity of the database.

    E.g: sp_helpdb,sp_renamedb,sp_depends etc.

  • What Is Trigger?

    A trigger is a SQL procedure that initiates an action when an event (INSERT, DELETE or UPDATE) occurs. Triggers are stored in and managed by the DBMS. Triggers are used to maintain the referential integrity of data by changing the data in a systematic fashion. A trigger cannot be called or executed; DBMS automatically fires the trigger as a result of a data modification to the associated table. Triggers can be viewed as similar to stored procedures in that both consist of procedural logic that is stored at the database level. Stored procedures, however, are not event‐drive and are not attached to a specific table as triggers. Stored procedures are explicitly executed by invoking a CALL to the procedure while triggers are implicitly executed. In addition, triggers can also execute stored procedures.

    Nested Trigger: A trigger can also contain INSERT, UPDATE and DELETE logic within itself, so when the trigger is fired because of data modification it can also cause another data modification, thereby firing another trigger. A trigger that contains data modification logic within itself is called a nested trigger.

  • What Is View?

    A simple view can be thought of as a subset of a table. It can be used for retrieving data, as well as updating or deleting rows. Rows updated or deleted in the view are updated or deleted in the table  when the view was created. It should also be noted that as data in the original table changes, so does data in the view, as views are the way to look at part of the original table. The results of using a view are not permanently stored in the database. The data accessed through a view is actually constructed using standard T‐SQL select command and can come from one to many different base tables or even other views.

  • What Is Index?

    An index is a physical structure containing pointers to the data. Indices are created in an existing table to locate rows more quickly and efficiently. It is possible to create an index on one or more columns of a table, and each index is given a name. The users cannot see the indexes; they are just used to speed up queries. Effective indexes are one of the best ways to improve performance in a database application. A table scan happens when there is no index available to help a query. In a table scan SQL Server examines every row in the table to satisfy the query results. Table scans are sometimes unavoidable, but on large tables, scans have a terrific impact on performance.

  • What Is A Linked Server?

    Linked Servers is a concept in SQL Server by which we can add other SQL Server to a Group and query both the SQL Server dbs using T‐SQL Statements. With a linked server, you can create very clean, easy to follow, SQL statements that allow remote data to be retrieved, joined and combined with local data. Stored Procedure sp_addlinked server, sp_addlinkedsrvlogin will be used add new Linked Server.

  • What Is Cursor?

    Cursor is a database object used by applications to manipulate data in a set on a row‐by‐row basis, instead of the typical SQL commands that operate on all the rows in the set at one time.

    In order to work with a cursor we need to perform some steps in the following order:

    • Declare cursor,
    • Open cursor,
    • Fetch row from the cursor,
    • Process fetched row,
    • Close cursor,
    • Deallocate cursor.
  • What Is Collation?

    The physical storage of character strings in SQL Server is controlled by collations. A collation specifies the bit patterns that represent each character and the rules by which characters are sorted and compared.

  • What Is Difference Between Function And Stored Procedure?

    UDF can be used in the SQL statements anywhere in the WHERE/HAVING/SELECT section where as Stored procedures cannot be. UDF's that return tables can be treated as another rowset. This can be used in JOIN's with other tables. Inline UDF's can be thought of as views that take parameters and can be used in JOINs and other Rowset operations.

  • What Is Sub-query? Explain Properties Of Sub-query?

    Sub‐queries are often referred to as sub‐selects, as they allow a SELECT statement to be executed arbitrarily within the body of another SQL statement. A sub‐query is executed by enclosing it in a set of parentheses. Sub‐queries are generally used to return a single row as an atomic value, though they may be used to compare values against multiple rows with the IN keyword.

    A sub query is a SELECT statement that is nested within another T‐SQL statement. A sub query SELECT statement if executed independently of the T‐SQL statement, in which it is nested, will return a resultset. Meaning a subquery SELECT statement can standalone and is not depended on the statement in which it is nested. A subquery SELECT statement can return any number of values, and can be found in the column list of a SELECT statement, a FROM, GROUP BY, HAVING, and/or ORDER BY clauses of a T‐SQL statement. A Subquery can also be used as a parameter to a function call. Basically a subquery can be used anywhere an expression can be used.

  • What Are Different Types Of Join?

    Cross Join
    A cross join that does not have a WHERE clause produces the Cartesian product of the tables involved in the join. The size of a Cartesian product result set is the number of rows in the first table multiplied by the number of rows in the seond table. The common example is when company wants to combine each product with a pricing table to analyze each product at each price.

    Inner Join:
    A join that displays only the rows that have a match in both joined tables is known as inner Join. This is the default type of join in the Query and View Designer.

    Outer Join:
    A join that includes rows even if they do not have related rows in the joined table is an Outer Join. You can create three different outer join to specify the unmatched rows to be included:

    Left Outer Join:
    In Left Outer Join all rows in the first‐named table i.e. "left" table, which appears leftmost in the JOIN clause are included. Unmatched rows in the right table do not appear.

    Right Outer Join:
    In Right Outer Join all rows in the second‐named table i.e. "right" table, which appears rightmost in the JOIN clause are included. Unmatched rows in the left table are not included.

    Full Outer Join:
    In Full Outer Join all rows in all joined tables are included, whether they are matched or not.

    Self Join:
    This is a particular case when one table joins to itself, with one or two aliases to avoid confusion. A self join can be of any type, as long as the joined tables are the same. A self join is rather unique in that it involves a relationship with only one table. The common example is when company has a hierarchal reporting structure whereby one member of staff reports to another. Self Join can be Outer Join or Inner Join.

  • What Are Primary Keys And Foreign Keys?

    Primary keys are the unique identifiers for each row. They must contain unique values and cannot be null. Due to their importance in relational databases, Primary keys are the most fundamental of all keys and constraints. A table can have only one Primary key.

    Foreign keys are both a method of ensuring data integrity and a manifestation of the relationship between tables.

  • What Is User Defined Functions? What Kind Of User-defined Functions Can Be Created?

    User‐Defined Functions allow defining its own T‐SQL functions that can accept 0 or more parameters and return a single scalar data value or a table data type.

    Different Kinds of User‐Defined Functions created are:

    Scalar User‐Defined Function:
    A Scalar user‐defined function returns one of the scalar data types. Text, ntext, image and timestamp data types are not supported. These are the type of user‐defined functions that most developers are used to in other programming languages. You pass in 0 to many parameters and you get a return value.

    Inline Table‐Value User‐Defined Function
    An Inline Table‐Value user‐defined function returns a table data type and is an exceptional alternative to a view as the user‐defined function can pass parameters into a T‐SQL select command and in essence provide us with a parameterized, non‐updateable view of the underlying tables.

    Multi‐statement Table‐Value User‐Defined Function
    A Multi‐Statement Table‐Value user‐defined function returns a table and is also an exceptional alternative to a view as the function can support multiple T‐SQL statements to build the final result where the view is limited to a single SELECT statement. Also, the ability to pass parameters into a T-SQL select command or a group of them gives us the capability to in essence create a paameterized, non‐updateable view of the data in the underlying tables. Within the create function command you must define the table structure that is being returned. After creating this type of user‐defined function, It can be used in the FROM clause of a T‐SQL command unlike the behavior found when using a stored procedure which can also return record sets.

  • What Is Identity?

    Identity (or AutoNumber) is a column that automatically generates numeric values. A start and increment value can be set, but most DBA leave these at 1. A GUID column also generates numbers; the value of this cannot be controlled. Identity/GUID columns do not need to be indexed.

  • What Is Datawarehousing?

    • Subject‐oriented, meaning that the data in the database is organized so that all the data elements relating to the same real‐world event or object are linked together;
    • Time‐variant, meaning that the changes to the data in the database are tracked and recorded so that reports can be produced showing changes verSUS  time;
    • Non‐volatile, meaning that data in the database is never over‐written or deleted, once committed, the data is static, read‐only, but retained for future reporting.
    • integrated, meaning that the database contains data from most or all of an organization's operational applications, and that this data is made consistent.
  • Which Tcp/ip Port Does Sql Server Run On? How Can It Be Changed?

    SQL Server runs on port 1433. It can be changed from the Network Utility TCP/IP properties –> Port number, both on client and the server.

  • What Are The Difference Between Clustered And A Non-clustered Index?

    A clustered index is a special type of index that reorders the way records in the table are physically stored. Therefore table can have only one clustered index. The leaf nodes of a clustered index contain the data pages.

    A non clustered index is a special type of index in which the logical order of the index does not match the physical stored ordr of the rows on disk. The leaf node of a non clustered index does not consist of the data pages. Instead, the leaf nodes contain index rows.

  • What Are The Different Index Configurations A Table Can Have?

    A table can have one of the following index configurations:

    • No indexes,
    • A clustered index,
    • A clustered index and many nonclustered indexes,
    • A nonclustered index,
    • Many nonclustered indexes.
  • What Are Different Types Of Collation Sensitivity?

    • Case sensitivity ‐ A and a, B and b, etc.
    • Accent sensitivity ‐ a and á, o and ó, etc.
    • Kana Sensitivity ‐ When Japanese kana characters Hiragana and Katakana are treated differently, it is called Kana sensitive.
    • Width sensitivity ‐ A single‐byte character (half‐width) and the same character represented as a double‐byte character (full‐width) are treated differently than it is width sensitive.
  • What Is Oltp (online Transaction Processing)?

    In OLTP ‐ online transaction processing systems relational database design use the discipline of data modeling and generally follow the odd rules of data normalization in order to ensure absolute data integrity. Using these rules complex information is broken down into its most simple structures (a table) where all of the individual atomic level elements relate to each other and satisfy the normalization rules.

  • What Iss The Difference Between A Primary Key And A Unique Key?

    Both primary key and unique key enforces uniqueness of the column on which they are defined. But by default primary key creates a clustered index on the column, where are unique creates a nonclustered index by default. Another major difference is that, primary key doesn't allow NULL's, but unique key allows one NULL only.

  • What Is Difference Between Delete & Truncate Commands?

    Delete command removes the rows from a table based on the condition that we provide with a WHERE clause. Truncate will actually remove all the rows from a table and there will be no data in the table after we run the truncate commad.

    TRUNCATE

    • TRUNCATE is faster and uses fewer system and transaction log resources than DELETE.
    • TRUNCATE removes the data by deallocating the data pages used to store the table’s data, and only the page deallocations are recorded in the transaction log.
    • TRUNCATE removes all rows from a table, but the table structure, its columns, constraints, indexes and so on, remains. The counter used by an identity for new rows is reset to the seed for the column.
    • You cannot use TRUNCATE TABLE on a table referenced by a FOREIGN KEY constraint. Because TRUNCATE TABLE is not logged, it cannot activate a trigger.
    • TRUNCATE cannot be rolled back.
    • TRUNCATE is DDL Command.
    • TRUNCATE Resets identity of the table.

    DELETE

    • DELETE removes rows one at a time and records an entry in the transaction log for each deleted row.
    • If you want to retain the identity counter, use DELETE instead. If you want to remove table definition and its data, use the DROP TABLE statement.
    • DELETE Can be used with or without a WHERE clause
    • DELETE Activates Triggers.
    • DELETE can be rolled back.
    • DELETE is DML Command.
    •  DELETE does not reset identity of the table.
  • When Is The Use Of Update_statistics Command?

    This command is basically used when a large processing of data has occurred. If a large amount of deletions any modification or Bulk Copy into the tables has occurred, it has to update the indexes to take these changes into account. UPDATE_STATISTICS updates the indexes on these tables accordingly.

  • What Is The Difference Between A Having Clause And A Where Clause?

    They specify a search condition for a group or an aggregate. But the difference is that HAVING can be used only with the SELECT statement. HAVING is typically used in a GROUP BY clause. When GROUP BY is not used, HAVING behaves like a WHERE clause. Having Clause is basically used only with the GROUP BY function in a query whereas WHERE Clause is applied to each row before they are part of the GROUP BY function in a query.

  • What Are The Properties And Different Types Of Sub-queries?

    Properties of Sub‐Query

    • A sub‐query must be enclosed in the parenthesis,
    • A sub‐query must be put in the right hand of the comparison operator and,
    • A sub‐query cannot contain an ORDER‐BY clause,
    • A query can contain more than one sub‐query.

    Types of Sub‐query

    • Single‐row sub‐query, where the sub‐query returns only one row,
    • Multiple‐row sub‐query, where the sub‐query returns multiple rows and,
    • Multiple column sub‐query, where the sub‐query returns multiple columns.
  • What Is Sql Profiler?

    SQL Profiler is a graphical tool that allows system administrators to monitor events in an instance of Microsoft SQL Server. You can capture and save data about each event to a file or SQL Server table to analyze later. For example, you can monitor a production environment to see which stored procedures are hampering performances by executing too slowly.

    Use SQL Profiler to monitor only the events in which you are interested. If traces are becoming too large, you can filter them based on the information you want, so that only a subset of the event data is collected. Monitoring too many events adds overhead to the server and the monitoring process and can cause the trace file or trace table o grow very large, especially when the monitoring process takes place over a long period of time.

  • What Are The Authentication Modes In Sql Server? How Can It Be Changed?

    Windows mode and Mixed Mode ‐ SQL & Windows.

    To change authentication mode in SQL Server click Start, Programs, Microsoft SQL Server and click SQL Enterprise Manager to run SQL Enterprise Manager from the Microsoft SQL Server program group. Select the server then from the Tools menu select SQL Server Configuration Properties, and choose the Security page.

  • Which Command Using Query Analyzer Will Give You The Version Of Sql Server And Operating System?

    SELECT SERVERPROPERTY ('productversion'), SERVERPROPERTY ('productlevel'), SERVERPROPERTY ('edition').

  • What Is Sql Server Agent?

    SQL Server agent plays an important role in the day‐to‐day tasks of a database administrator (DBA). It is often overlooked as one of the main tools for SQL Server management. Its purpose is to ease the implementation of tasks for the DBA, with its full‐function scheduling engine, which allows you to schedule your own jobs and scripts.

  • Can A Stored Procedure Call Itself Or Recursive Stored Procedure? How Much Level Sp Nesting Is Possible?

    Yes.

    Because Transact‐SQL supports recursion, you can write stored procedures that call themselves. Recursion can be defined as a method of problem solving wherein the solution is arrived at by repetitively applying it to subsets of the problem. A common application of recursive logic is to perform numeric computations that lend themselves to repetitive evaluation by th same processing steps. Stored procedures are nested when one stored procedure calls another or executes managed code by referencing a CLR routine, type, or aggregate. You can nest stored procedures and managed code references up to 32 levels.

  • What Is Log Shipping?

    Log shipping is the process of automating the backup of database and transaction log files on a production SQL server, and then restoring them onto a standby server. Enterprise Editions only supports log shipping. In log shipping the transactional log file from one server is automatically updated into the backup database on the other servr. If one server fails, the other server will have the same db and can be used this as the Disaster Recovery plan. The key feature of log shipping is that it will automatically backup transaction logs throughout the day and automatically resore them on the standby server at defined interval.

  • Name 3 Ways To Get An Accurate Count Of The Number Of Records In A Table1?

    SELECT * FROM table1,
    SELECT COUNT(*) FROM table1,
    SELECT rows FROM sysindexes WHERE id = OBJECT_ID(table1) AND indid < 2.
  • What Does It Mean To Have Quoted_identifier On? What Are The Implications Of Having It Off?

    When SET QUOTED_IDENTIFIER is ON, identifiers can be delimited by double quotation marks, and literals must be delimited by single quotation marks. When SET QUOTED_IDENTIFIER is OFF, identifiers cannot be quoted and must follow all Transact‐SQL rules for identifiers.

  • What Is The Difference Between A Local And A Global Temporary Table?

    A local temporary table exists only for the duration of a connection or, if defined inside a compound statement, for the duration of the compound statement.

    A global temporary table remains in the database permanently, but the rows exist only within a given connection. When connection is closed, the data in the global temporary table disappears. However, the table definition remains with the database for access when database is opened next time.

  • What Is The Stuff Function And How Does It Differ From The Replace Function?

    STUFF function is used to overwrite existing characters. Using this syntax, STUFF (string_expression, start, length, replacement_characters), string_expression is the string that will have characters substituted, start is the starting position, length is the number of characters in the string that are substituted, and replacement_ characters are the new characters interjected into the string. REPLACE function to replace existing characters of all occurrences. Using the syntax REPLACE (string_expression, search_string, replacement_string), where every incidence of search_string found in the string_expression will be replaced with replacement_string.

  • What Is Primary Key?

    A PRIMARY KEY constraint is a unique identifier for a row within a database table. Every table should have a primary key constraint to uniquely identify each row and only one primary key constraint can be created for each table. The primary key constraints are used to enforce entity integrity.

  • What Is Unique Key Constraint?

    A UNIQUE constraint enforces the uniqueness of the values in a set of columns, so no duplicate values are entered. The unique key constraints are used to enforce entity integrity as the primary key constraints.

  • What Is Foreign Key?

    A FOREIGN KEY constraint prevents any actions that would destroy links between tables with the corresponding data values. A foreign key in one table points to a primary key in another table. Foreign keys prevent actions that would leave rows with foreign key values when there are no primary keys with that value. The foreign key constraints are used to enforce referential integrity.

  • What Is Check Constraint?

    A CHECK constraint is used to limit the values that can be placed in a column. The check constraints are used to enforce domain integrity.

  • What Is Not Null Constraint?

    A NOT NULL constraint enforces that the column will not accept null values. The not null constraints are used to enforce domain integrity, as the check constraints.

  • How To Get @@error And @@rowcount At The Same Time?

    If @@Rowcount is checked after Error checking statement then it will have 0 as the value of @@Recordcount as it would have been reset. And if @@Recordcount is checked before the error‐checking statement then @@Error would get reset. To get @@error and @@rowcount at the same time do both in same statement and store them in local variable. SELECT @RC = @@ROWCOUNT, @ER = @@ERROR.

  • What Is A Scheduled Jobs Or What Is A Scheduled Tasks?

    Scheduled tasks let user automate processes that run on regular or predictable cycles. User can schedule administrative tasks, such as cube processing, to run during times of slow business activity. User can also determine the order in which tasks run by creating job steps within a SQL Server Agent job. E.g. back up database, Update Status of Tables. Job steps give user control over flow of execution. If one job fails, user can configure SQL Server Agent to continue to run the remaining tasks or to stop execution.

  • What Are The Advantages Of Using Stored Procedures?

    • Stored procedure can reduced network traffic and latency, boosting application performance.
    • Stored procedure execution plans can be reused, staying cached in SQL Server's memory, reducing server overhead.
    • Stored procedures help promote code reuse.
    • Stored procedures can encapsulate logic. You can change stored procedure code without affecting clients.
    • Stored procedures provide better security to your data.
  • What Is A Table Called, If It Has Neither Cluster Nor Non-cluster Index? What Is It Used For?

    Unindexed table or Heap. Microsoft Press Books and Book online (BOL) refers it as Heap. A heap is a table that does not have a clustered index and therefore, the pages are not linked by pointers. The IAM pages are the only structures that link the pages in a table together. Unindexed tables are good for fast storing of data. Many times it is better to drop all indexes from table and then do bulk of inserts and to restore those indexes after that.

  • Can Sql Servers Linked To Other Servers Like Oracle?

    SQL Server can be linked to any server provided it has OLE‐DB provider from Microsoft to allow a link. E.g. Oracle has an OLE‐DB provider for oracle that Microsoft provides to add it as linked server to SQL Server group.

  • What Is Bcp? When Does It Used?

    BulkCopy is a tool used to copy huge amount of data from tables and views. BCP does not copy the structures same as source to destination. BULK INSERT command helps to import a data file into a database table or view in a user‐specified format.

  • How To Implement One-to-one, One-to-many And Many-to-many Relationships While Designing Tables?

    One‐to‐One relationship can be implemented as a single table and rarely as two tables with primary and foreign key relationships. One‐to‐Many relationships are implemented by splitting the data into two tables with primary key and foreign key relationships.

    Many‐to‐Many relationships are implemented using a junction table with the keys from both the tables forming the composite primary key for  the junction table.

  • What Is An Execution Plan? When Would You Use It? How Would You View The Execution Plan?

    An execution plan is basically a road map that graphically or textually shows the data retrieval methods chosen by the SQL Server query optimizer for a stored procedure or ad‐hoc query and is a very useful tool for a developer to understand the performance characteristics of a query or stored procedure  since the plan is the one that SQL Server will place in its cache and use to execute the stored procedure or query. From within Query Analyzer is an option called "Show Execution Plan" (located on the Query drop‐down menu). If this option is turned on it will display query execution plan in separate window when query is run again.

  • What Are The Basic Functions For Master, Msdb, Model, Tempdb And Resource Databases?

    The master database holds information for all databases located on the SQL Server instance and is the glue that holds the engine together. Because SQL Server cannot start without a functioning masterdatabase, you must administor this database with care.

    The msdb database stores information regarding database backups, SQL Agent information, DTS packages, SQL Server jobs, and some replication information such as for log shipping.

    The tempdb holds temporary objects such as global and local temporary tables and stored procedures.

    The model is essentially a template database used in the creation of any new user database created in the instance.

    The resoure Database is a read‐only database that contains all the system objects that are included with SQL Server. SQL Server system objects, such as sys.objects, are physically persisted in the Resource database, but they logically appear in the sys schema of every database. The Resource database does not contain user data or user metadata.

  • What Is Service Broker?

    Service Broker is a message‐queuing technology in SQL Server that allows developers to integrate SQL Server fully into distributed applications. Service Broker is feature which provides facility to SQL Server to send an asynchronous, transactional message. it allows a database to send a message to another database without waiting for the response, so the application will continue to function if the remote database is temporarily unavailable.

  • Where Sql Server User Names And Passwords Are Stored In Sql Server?

    They get stored in System Catalog Views sys.server_principles and sys.sql_logins.

  • What Is Policy Management?

    Policy Management in SQL SERVER 2008 allows you to define and enforce policies for configuring and managing SQL Server across te enterprise. Policy‐Based Management is configured in SQL Server Management Studio (SSMS). Navigate to the Object Explorer and expand the Management node and the Policy Management node; you will see the Policies, Conditions, and Facets nodes.

  • What Is Replication And Database Mirroring?

    Database mirroring can be used with replication to provide availability for the publication database. Database mirroring involves two copies of a single database that typically reside on different computers. At any given time, only one copy of the database is currently available to clients which are known as the principal database. Updates made by clients to the principal database are applied on the other copy of the database, known as the mirror database. Mirroring involves applying the transaction log from every insertion, update, or deletion made on the principal database onto the mirror database.

  • What Are Sparse Columns?

    A sparse column is another tool used to reduce the amount of physical storage used in a database. They are the ordinary columns that have an optimized storage for null values. Sparse columns reduce the space requirements for null values at the cost of more overhead to retrieve non-null values.

  • What Does Top Operator Do?

    The TOP operator is used to specify the number of rows to be returned by a query. The TOP operator has new addition in SQL SERVER 2008 that it accepts variables as well as literal values and can be used with INSERT, UPDATE, and DELETES statements.

  • What Is Cte?

    CTE is an abbreviation of Common Table Expression. A Common Table Expression (CTE) is an expression that can be thought of as a temporary result set which is defined within the execution of a single SQL statemnt. A CTE is similar to a derived table in that it is not stored as an object and lasts only for the duration of the query.

  • What Is Merge Statement?

    MERGE is a new feature that provides an efficient way to perform multiple DML operations. In previous versions of SQL Server, we had to write separate statements to INSERT, UPDATE, or DELETE data based on certain conditions, but now, using MERGE statement we can include the logic of such data modifications in one statement that even checks when the data is matched then just update it and when unmatched then insert it. One of the most important advantages of MERGE statement is all the data is read and processed only once.

  • What Is Filtered Index?

    Filtered Index is used to index a portion of rows in a table that means it applies filter on INDEX which improves query performnce, reduce index maintenance costs, and reduce index storage costs compared with full‐table indexes. When we see an Index created with some where clause then that is actually a FILTERED INDEX.

  • Which Are New Data Types Introduced In Sql Server 2008?

    The GEOMETRY Type: The GEOMETRY data type is a system .NET common language runtime (CLR) data type in SQL Server. This type represents data in a two‐dimensional Euclidean coordinate system.

    The GEOGRAPHY Type: The GEOGRAPHY datatype’s functions are the same as with GEOMETRY. The difference between the two is that when you specify GEOGRAPHY, you are usually specifying points in terms of latitude and longitude.

    New Date and Time Datatypes: SQL Server 2008 introduces four new datatypes related to date and time: DATE, TIME, DATETIMEOFFSET, and DATETIME2.

    • DATE: The new DATE type just stores the date itself. It is based on the Gergorian calendar and handles years from 1 to 9999.
    • TIME: The new TIME (n) type stores time with a range of 00:00:00.0000000 through 23:59:59.9999999. The precision is allowed with this type. TIME supports seconds down to 100 nanoseconds. The n in TIME (n) defines this level of fractional second precision, from 0 to 7 digits of precision.
    • The DATETIMEOFFSET Type: DATETIMEOFFSET (n) is the time‐zone‐aware version of a datetime datatype. The name will appear less odd when you consider what it really is: a date + a time + a time‐zone offset. The offset is based on how far behind or ahead you are from Coordinated Universal Time (UTC) time.
    • The DATETIME2 Type: It is an extension of the datetime type in earlier versions of SQL Server. This new datatype has a date range covering dates from January 1 of year 1 through December 31 of year 9999. This is a definite improvement over the 1753 lower boundary of the datetime datatype.

    DATETIME2 not only includes the larger date range, but also has a timestamp and the same fractional precision that TIME type provides.

  • What Are The Advantages Of Using Cte?

    • Using CTE improves the readability and makes maintenance of complex queries easy.
    • The query can be divided into separate, simple, logical building blocks which can be then used to build more complex CTE's until final result set is generated.
    • CTE can be defined in functions, stored procedures, triggers or even views.
    • After a CTE is defined, it can be used as a Table or a View and can SELECT, INSERT, UPDATE or DELETE Data.
  • How Can We Rewrite Sub-queries Into Simple Select Statements Or With Joins?

    we can write using Common Table Expression (CTE). A Common Table Expression (CTE) is an expression that can be thought of as a temporary result set which is defined within the execution of a single SQL statemnt. A CTE is similar to a derived table in that it is not stored as an object and lasts only for the duration of the query.

    E.g.

    USE AdventureWorks 
    GO WITH
    EmployeeDepartment_CTE AS(SELECT EmployeeID,DepartmentID,
    ShiftID FROM HumanResources.Employee Department History)
    SELECT ecte.EmployeeId, ed.Department ID, ed.Name, ecte.ShiftID
    FROM HumanResources. Department ed INNER JOIN EmployeeDepartment_CTE 
    ecte ON ecte. Department ID = ed.Department ID 
    GO
  • What Is Clr?

    In SQL Server 2008, SQL Server objects such as user‐defined functions can be created using such CLR languages. This CLR language support extends not only to user‐defined functions, but also to stored procedures and triggers. You can develop such CLR add‐ons to SQL Server using Visual Studio 2008.

  • What Are Synonyms?

    Synonyms give you the ability to provide alternate names for database objects. You can alias object names; for example, using the Employee table as Emp. You can also shorten names. This is especially useful when dealing with three and four part names; for example, shortening server.database.owner.object to object.

  • What Is Linq?

    Language Integrated Query (LINQ) adds the ability to query objects using .NET languages. The LINQ to SQL object/relational mapping (O/RM) framework provides the following basic features:

    • Tools to create classes (usually called entities) mapped to database tables
    • Compatibility with LINQ’s standard query operations
    • The DataContext class, with features such as entity record monitoring, automatic SQL statement generation, record concurrency detection, and much more.
  • What Is The Clr?

    The CLR is a set of standard resources that (in theory) any .NET program can take advantage of, regardless of programming language. Many .NET framework classes Development, debugging, and profiling tools Execution and code management IL-to-native translators and optimizers What this means is that in the .NET world, different programming languages will be more equal in capability than they have ever been before, although clearly not all languages will support all CLR services.

  • What Is The Cts?

    This is the range of types that the .NET runtime understands, and therefore that .NET applications can use. However note that not all .NET languages will support all the types in the CTS. The CTS is a superset of the CLS.

  • What Is The Cls?

    This is a subset of the CTS which all .NET languages are expected to support. The idea is that any program which uses CLS-compliant types can interoperate with any .NET program written in any language.

     

  • What Is Il?

    Also known as MSIL (Microsoft Intermediate Language) or CIL (Common Inter mediate Language). All .NET source code (of any language) is compiled to IL. The IL is then converted to machine code at the point where the software is installed, or at run-time by a Just-In-Time (JIT) compiler.

  • What Does 'managed' Mean In The .net Context?

    Managed code: The .NET framework provides several core run-time services to the programs that run within it - for example exception handling and security. For these services to work, the code must provide a minimum level of information to the runtime.

    Such code is called managed code. All C# and Visual Basic.NET code is managed by default. VS7 C++ code is not managed by default, but the compiler can produce managed code by specifying a command-line switch (/com+).

    Managed data: This is data that is allocated and de-allocated by the .NET runtime's garbage collector. C# and VB.NET data is always managed. VS7 C++ data is unmanaged by default, even when using the /com+ switch, but it can be marked as managed using the __gc keyword.

    Managed classes: This is usually referred to in the context of Managed Extensions (ME) for C++. When using ME C++, a class can be marked with the __gc keyword. As the name suggests, this means that the memory for instances of the class is managed by the garbage collector, but it also means more than that. The class becomes a fully paid-up member of the .NET community with the benefits and restrictions that brings. An example of a benefit is proper interop with classes written in other languages - for example, a managed C++ class can inherit from a VB class. An example of a restriction is that a managed class can only inherit from one base class.

  • What Is Reflection?

    All .NET compilers produce metadata about the types defined in the modules they produce. This metadata is packaged along with the module (modules in turn are packaged together in assemblies), and can be accessed by a mechanism called reflection. The System.Reflection namespace contains classes that can be used to interrogate the types for a module/assembly.

    Using reflection to access .NET metadata is very similar to using ITypeLib/ITypeInfo to access type library data in COM, and it is used for similar purposes - e.g. determining data type sizes for marshaling data across context/process/machine boundaries.

    Reflection can also be used to dynamically invoke methods (see System.Type.InvokeMember ) , or even create types dynamically at run-time (see System.Reflection.Emit.TypeBuilder).

  • What Is The Difference Between Finalize And Dispose (garbage Collection) ?

    Class instances often encapsulate control over resources that are not managed by the runtime, such as window handles (HWND), database connections, and so on. Therefore, you should provide both an explicit and an implicit way to free those resources. Provide implicit control by implementing the protected Finalize Method on an object (destructor syntax in C# and the Managed Extensions for C++). The garbage collector calls this method at some point after there are no longer any valid references to the object. In some cases, you might want to provide programmers using an object with the ability to explicitly release these external resources before the garbage collector frees the object. If an external resource is scarce or expensive, better performance can be achieved if the programmer explicitly releases resources when they are no longer being used. To provide explicit control, implement the Dispose method provided by the IDisposable Interface. The consumer of the object should call this method when it is done using the object.

    Dispose can be called even if other references to the object are alive. Note that even when you provide explicit control by way of Dispose, you should provide implicit cleanup using the Finalize method. Finalize provides a backup to prevent resources from permanently leaking if the programmer fails to call Dispose.

  • What Is Partial Assembly References?

    Full Assembly reference: A full assembly reference includes the assembly's text name, version, culture, and public key token (if the assembly has a strong name). A full assembly reference is required if you reference any assembly that is part of the common language runtime or any assembly located in the global assembly cache.

  • Changes To Which Portion Of Version Number Indicates An Incompatible Change?

    Major or minor. Changes to the major or minor portion of the version number indicate an incompatible change. Under this convention then, version 2.0.0.0 would be considered incompatible with version 1.0.0.0. Examples of an incompatible change would be a change to the types of some method parameters or the removal of a type or method altogether. Build. The Build number is typically used to distinguish between daily builds or smaller compatible releases. Revision. Changes to the revision number are typically reserved for an incremental build needed to fix a particular bug. You'll sometimes hear this referred to as the "emergency bug fix" number in that the revision is what is often changed when a fix to a specific bug is shipped to a customer.

  • How To Set The Debug Mode?

    Debug Mode for ASP.NET applications - To set ASP.NET appplication in debugging mode, edit the application's web.config and assign the "debug" attribute in < compilation > section to "true" as show below:

    < configuration >
    < system.web >
    < compilation defaultLanguage="vb" debug="true" / >
    ....
    ...
    ..
    < / configuration >

    This case-sensitive attribute debug tells ASP.NET to generate symbols for dynamically generated files and enables the debugger to attach to the ASP.NET application. ASP.NET will detect this change automatically, without the need to restart the server. Debug Mode for ASP.NET Webservices - Debugging an XML Web service created with ASP.NET is similar to the debugging an ASP.NET Web application.

  • What Is Managed And Unmanaged Code?

    The .NET framework provides several core run-time services to the programs that run within it - for example exception handling and security. For these services to work, the code must provide a minimum level of information to the runtime. i.e., code executing under the control of the CLR is called managed code. For example, any code written in C# or Visual Basic .NET is managed code. Code that runs outside the CLR is referred to as "unmanaged code." COM components, ActiveX components, and Win32 API functions are examples of unmanaged code.

  • Describe The Advantages Of Writing A Managed Code Application Instead Of Unmanaged One. What's Involved In Certain Piece Of Code Being Managed?

    "Advantages includes automatic garbage collection, memory management, security, type checking, versioning.

    Managed code is compiled for the .NET run-time environment. It runs in the Common Language Runtime (CLR), which is the heart of the .NET Framework. The CLR provides services such as security, memory management, and cross-language integration. Managed applications written to take advantage of the features of the CLR perform more efficiently and safely, and take better advantage of developers existing expertise in languages that support the .NET Framework.

    Unmanaged code includes all code written before the .NET Framework was introduced—this includes code written to use COM, native Win32, and Visual Basic 6. Because it does not run inside the .NET environment, unmanaged code cannot make use of any .NET managed facilities."

  • What Is Boxing And Unboxing?

    Boxing is implicit conversion of ValueTypes to Reference Types (Object). UnBoxing is explicit conversion of Reference Types (Object) to its equivalent ValueTypes. It requires type-casting.

  • What Is The Sequence Of Operation Takes Place When A Page Is Loaded?

    • BeginTranaction - only if the request is transacted,
    • Init - every time a page is processed,
    • LoadViewState - Only on postback,
    • ProcessPostData1 - Only on postback,
    • Load - every time,
    • ProcessData2 - Only on Postback,
    • RaiseChangedEvent - Only on Postback,
    • RaisePostBackEvent - Only on Postback,
    • PreRender - everytime,
    • BuildTraceTree - only if tracing is enabled,
    • SaveViewState - every time,
    • Render - Everytime,
    • End Transaction - only if the request is transacted,
    • Trace.EndRequest - only when tracing is enabled,
    • UnloadRecursive - Every request.
  • What Are The Different Types Of Assemblies Available And Their Purpose?

    Private, Public/shared and Satellite Assemblies.

    Private Assemblies : Assembly used within an application is known as private assemblies.

    Public/shared Assemblies : Assembly which can be shared across applicaiton is known as shared assemblies. Strong Name has to be created to create a shared assembly. This can be done using SN.EXE. The same has to be registered using GACUtil.exe (Global Assembly Cache).

    Satellite Assemblies : These assemblies contain resource files pertaining to a locale (Culture+Language). These assemblies are used in deploying an Gloabl applicaiton for different languages.

  • Describe The Role Of Inetinfo.exe, Aspnet_isapi.dll And Aspnet_wp.exe In The Page Loading Process ?

    inetinfo.exe is the Microsoft IIS server running, handling ASP.NET requests among other things. When an ASP.NET request is received (usually a file with .aspx extension), the ISAPI filter aspnet_isapi.dll takes care of it by passing the request to the actual worker process aspnet_wp.exe.

  • Where Do You Store The Information About The User's Locale?

    System.Web.UI.Page.Culture

  • What Is Difference Between Webconfig.xml & Machineconfig.xml?

    Web.config & machine.config both are configuration files.Web.config contains settings specific to an application where as machine.config contains settings to a computer. The Configuration system first searches settings in machine.config file & then looks in application configuration files.Web.config, can appear in multiple directories on an ASP.NET Web application server. Each Web.config file applies configuration settings to its own directory and all child directories below it. There is only Machine.config file on a web server.

  • How Is The Dll Hell Problem Solved In .net?

    Assembly versioning allows the application to specify not only the library it needs to run (which was available under Win32), but also the version of the assembly.

  • What Are The Ways To Deploy An Assembly?

    • An MSI installer,
    • a CAB archive and,
    • XCOPY command.
  • What Is A Satellite Assembly?

    When you write a multilingual or multi-cultural application in .NET, and want to distribute the core application separately from the localized modules, the localized assemblies that modify the core application are called satellite assemblies.

  • What Namespaces Are Necessary To Create A Localized Application?

    • System.Globalization and,
    • System.Resources.
  • What Is The Smallest Unit Of Execution In .net?

    An Assembly.

  • When Should You Call The Garbage Collector In .net?

    As a good rule, you should not call the garbage collector. However, you could call the garbage collector when you are done using a large object (or set of objects) to force the garbage collector to dispose of those very large objects from memory. However, this is usually not a good practice.

  • How Do You Convert A Value-type To A Reference-type?

    Use Boxing.

  • What Happens In Memory When You Box And Unbox A Value-type?

    Boxing converts a value-type to a reference-type, thus storing the object on the heap. Unboxing converts a reference-type to a value-type, thus storing the value on the stack.

  • Describe The Difference Between A Thread And A Process?

    A Process is an instance of an running application. And a thread is the Execution stream of the Process. A process can have multiple Thread.

    When a process starts a specific memory area is allocated to it. When there is multiple thread in a process, each thread gets a memory for storing the variables in it and plus they can access to the global variables which is common for all the thread.

    Eg. A Microsoft Word is a Application. When you open a word file, an instance of the Word starts and a process is allocated to this instance which has one thread.

  • What Is The Difference Between An Exe And A Dll?

    You can create an objects of Dll but not of the EXE.

    Dll is an In-Process Component whereas EXE is an OUt-Process Component.

    Exe is for single use whereas you can use Dll for multiple use.

    Exe can be started as standalone where dll cannot be.

  • What Is Strong-typing Versus Weak-typing? Which Is Preferred? Why?

    Strong typing implies that the types of variables involved in operations are associated to the variable, checked at compile-time, and require explicit conversion; weak typing implies that they are associated to the value, checked at run-time, and are implicitly converted as required. (Which is preferred is a disputable point.

  • What Is The Gac? What Problem Does It Solve?

    Each computer where the common language runtime is installed has a machine-wide code cache called the global assembly cache. The global assembly cache stores assemblies that are to be shared by several applications on the computer. This area is typically the folder under windows or winint in the machine.

    All the assemblies that need to be shared across applications need to be done through the Global assembly Cache only. However it is not necessary to install assemblies into the global assembly cache to make them accessible to COM interop or unmanaged code.

    There are several ways to deploy an assembly into the global assembly cache:

    • Use an installer designed to work with the global assembly cache. This is the preferred option for installing assemblies into the global assembly cache.
    •  Use a developer tool called the Global Assembly Cache tool (Gacutil.exe), provided by the .NET Framework SDK.
    • Use Windows Explorer to drag assemblies into the cache.
    • GAC solves the problem of DLL Hell and DLL versioning. Unlike earlier situations, GAC can hold two assemblies of the same name but different version.

    This ensures that the applications which access a particular assembly continue to access the same assembly even if another version of that assembly is installed on that machine.

  • What Is An Asssembly Qualified Name? Is It A Filename? How Is It Different?

    An assembly qualified name isn't the filename of the assembly; it's the internal name of the assembly combined with the assembly version, culture, and public key, thus making it unique.

    e.g. (""System.Xml.XmlDocument, System.Xml, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c5 61934e089"").

  • How Is A Strongly-named Assembly Different From One That Is Not Strongly-named?

    Strong names are used to enable the stricter naming requirements associated with shared assemblies. These strong names are created by a .NET utility – sn.exe

    Strong names have three goals:

    •  Name uniqueness. Shared assemblies must have names that are globally unique.
    • Prevent name spoofing. Developers don't want someone else releasing a subsequent version of one of your assemblies and falsely claim it came from you, either by accident or intentionally.
    • Provide identity on reference. When resolving a reference to an assembly, strong names are used to guarantee the assembly that is loaded came from the expected publisher.

    Strong names are implemented using standard public key cryptography. In general, the process works as follows: The author of an assembly generates a key pair (or uses an existing one), signs the file containing the manifest with the private key, and makes the public key available to callers. When references are made to the assembly, the caller records the public key corresponding to the private key used to generate the strong name.

    Weak named assemblies are not suitable to be added in GAC and shared. It is essential for an assembly to be strong named.

    Strong naming prevents tampering and enables assemblies to be placed in the GAC alongside other assemblies of the same name.

  • Explain The Importance And Use Of Each, Version, Culture And Publickeytoken For An Assembly.

    This three along with name of the assembly provide a strong name or fully qualified name to the assembly. When a assembly is referenced with all three.

    PublicKeyToken: Each assembly can have a public key embedded in its manifest that identifies the developer. This ensures that once the assembly ships, no one can modify the code or other resources contained in the assembly.

    Culture: Specifies which culture the assembly supports.

    Version: The version number of the assembly.It is of the following form major,minor,build,revision.

  • Explain The Differences Between Public, Protected, Private And Internal.

    These all are access modifier and they governs the access level. They can be applied to class, methods, fields.

    Public: Allows class, methods, fields to be accessible from anywhere i.e. within and outside an assembly.

    Private: When applied to field and method allows to be accessible within a class.

    Protected: Similar to private but can be accessed by members of derived class also.

    Internal: They are public within the assembly i.e. they can be accessed by anyone within an assembly but outside assembly they are not visible.

  • What Is Difference Between Metadata And Manifest?

    Metadata and Manifest forms an integral part of an assembly( dll / exe ) in .net framework . Out of which Metadata is a mandatory component, which as the name suggests gives the details about various components of IL code viz : Methods, properties, fields, class etc.

    Essentially Metadata maintains details in form of tables like Methods Metadata tables , Properties Metadata tables, which maintains the list of given type and other details like access specifier , return type etc.

    Now Manifest is a part of metadata only, fully called as “manifest metadata tables” , it contains the details of the references needed by the assembly of any other external assembly / type , it could be a custom assembly or standard System namespace.

    Now for an assembly that can independently exists and used in the .Net world both the things ( Metadata with Manifest ) are mandatory , so that it can be fully described assembly and can be ported anywhere without any system dependency . Essentially .Net framework can read all assembly related information from assembly itself at runtime.

    But for .Net modules , that can’t be used independently , until they are being packaged as a part of an assembly , they don’t contain Manifest but their complete structure is defined by their respective metadata.

  • How Do Assemblies Find Each Other?

    By searching directory paths. There are several factors which can affect the path (such as the AppDomain host, and application configuration files), but for private assemblies the search path is normally the application's directory and its sub-directories. For shared assemblies, the search path is normally same as the private assembly path plus the shared assembly cache.

  • How Does Assembly Versioning Work?

    Each assembly has a version number called the compatibility version. Also each reference to an assembly (from another assembly) includes both the name and version of the referenced assembly.The version number has four numeric parts (e.g. 5.5.2.33). Assemblies with either of the first two parts different are normally viewed as incompatible. If the first two parts are the same, but the third is different, the assemblies are deemed as 'maybe compatible'. If only the fourth part is different, the assemblies are deemed compatible. However, this is just the default guideline - it is the version policy that decides to what extent these rules are enforced. The version policy can be specified via the application configuration file.

  • What Is Garbage Collection?

    Garbage collection is a system whereby a run-time component takes responsibility for managing the lifetime of objects and the heap memory that they occupy. This concept is not new to .NET - Java and many other languages/runtimes have used garbage collection for some time.

  • Why Doesn't The .net Runtime Offer Deterministic Destruction?

    Because of the garbage collection algorithm. The .NET garbage collector works by periodically running through a list of all the objects that are currently being referenced by an application. All the objects that it doesn't find during this search are ready to be destroyed and the memory reclaimed. The implication of this algorithm is that the runtime doesn't get notified immediately when the final reference on an object goes away - it only finds out during the next sweep of the heap.

    Futhermore, this type of algorithm works best by performing the garbage collection sweep as rarely as possible. Normally heap exhaustion is the trigger for a collection sweep.

  • Is The Lack Of Deterministic Destruction In .net A Problem?

    It's certainly an issue that affects component design. If you have objects that maintain expensive or scarce resources (e.g. database locks), you need to provide some way for the client to tell the object to release the resource when it is done. Microsoft recommend that you provide a method called Dispose() for this purpose. However, this causes problems for distributed objects - in a distributed system who calls the Dispose() method? Some form of reference-counting or ownership-management mechanism is needed to handle distributed objects - unfortunately the runtime offers no help with this.

  • What Is The Use Of Jit ?

    JIT (Just - In - Time) is a compiler which converts MSIL code to native code, Because the common language runtime supplies a JIT compiler for each supported CPU architecture, developers can write a set of MSIL that can be JIT-compiled and run on computers with different architectures. However, your managed code will run only on a specific operating system if it calls platform-specific native APIs, or a platform-specific class library.

    JIT compilation takes into account the fact that some code might never get called during execution. Rather than using time and memory to convert all the MSIL in a portable executable (PE) file to native code, it converts the MSIL as needed during execution and stores the resulting native code so that it is accessible for subsequent calls. The loader creates and attaches a stub to each of a type's methods when the type is loaded. On the initial call to the method, the stub passes control to the JIT compiler, which converts the MSIL for that method into native code and modifies the stub to direct execution to the location of the native code. Subsequent calls of the JIT-compiled method proceed directly to the native code that was previously generated, reducing the time it takes to JIT-compile and run the code.

  • What Is Delay Signing?

    Delay signing allows you to place a shared assembly in the GAC by signing the assembly with just the public key. This allows the assembly to be signed with the private key at a later stage, when the development process is complete and the component or assembly is ready to be deployed. This process enables developers to work with shared assemblies as if they were strongly named, and it secures the private key of the signature from being accessed at different stages of development.

  • What Is The Difference Between Response.write() And Response.output.write()?

    Response.Output.Write() allows you to write formatted output.

  • Should User Input Data Validation Occur Server-side Or Client-side? Why?

    All user input data validation should occur on the server at a minimum. Additionally, client-side validation can be performed where deemed appropriate and feasable to provide a richer, more responsive experience for the user.

  • What Is Msil, And Why Should Developers Need An Appreciation Of It If At All?

    MSIL is the Microsoft Intermediate Language. All .NET compatible languages will get converted to MSIL. MSIL also allows the .NET Framework to JIT compile the assembly on the installed computer.

  • What Does The "enableviewstate" Property Do? Why Would I Want It On Or Off?

    It allows the page to save the users input on a form across postbacks. It saves the server-side values for a given control into ViewState, which is stored as a hidden value on the page before sending the page to the clients browser. When the page is posted back to the server the server control is recreated with the state stored in viewstate.

  • What Is The Difference Between Value Types And Reference Types?

    Value Types uses Stack to store the data where as the later uses the Heap to store the data.

  • What Are User Controls And Custom Controls?

    Custom controls: A control authored by a user or a third-party software vendor that does not belong to the .NET Framework class library. This is a generic term that includes user controls. A custom server control is used in Web Forms (ASP.NET pages). A custom client control is used in Windows Forms applications.

    User Controls: In ASP.NET: A user-authored server control that enables an ASP.NET page to be re-used as a server control. An ASP.NET user control is authored declaratively and persisted as a text file with an .ascx extension. The ASP.NET page framework compiles a user control on the fly to a class that derives from the System.Web.UI.UserControl class.

  • What Are The Validation Controls?

    A set of server controls included with ASP.NET that test user input in HTML and Web server controls for programmer-defined requirements. Validation controls perform input checking in server code. If the user is working with a browser that supports DHTML, the validation controls can also perform validation using client script.

  • Where Do You Add An Event Handler?

    It is the Attributesproperty, the Add function inside that property. e.g. btnSubmit.Attributes.Add ("onMouse Over" ,"someClientCode();")

  • What Data Type Does The Rangevalidator Control Support?

    Integer,String and Date.

  • What Is The Implicit Name Of The Parameter That Gets Passed Into The Class Set Method?

    Value, and its datatype depends on whatever variable we are changing.

  • How Do You Inherit From A Class In C#?

    Place a colon and then the name of the base class. Notice that it’s double colon in C++.

  • Does C# Support Multiple Inheritance?

    No,

    use interfaces instead.

  • When You Inherit A Protected Class-level Variable, Who Is It Available To?

    Classes in the same namespace.

  • Are Private Class-level Variables Inherited?

    Yes,

    but they are not accessible, so looking at it you can honestly say that they are not inherited. But they are.

  • Describe The Accessibility Modifier Protected Internal?

    It is available to derived classes and classes within the same Assembly (and naturally from the base class it is declared in).

  • C# Provides A Default Constructor For Me. I Write A Constructor That Takes A String As A Parameter, But Want To Keep The No Parameter One. How Many Constructors Should I Write?

    Two.

    Once you write at least one constructor, C# cancels the freebie constructor, and now you have to write one yourself, even if there is no implementation in it.

  • What Is The Top .net Class That Everything Is Derived From?

    System.Object.

  • How Is Method Overriding Different From Overloading?

    When overriding, you change the method behavior for a derived class. Overloading simply involves having a method with the same name within the class.

  • What Does The Keyword Virtual Mean In The Method Definition?

    The method can be overridden.

  • Can You Declare The Override Method Static While The Original Method Is Non-static?

    No,

    you can’t, the signature of the virtual method must remain the same, only the keyword virtual is changed to keyword override.

  • Can You Override Private Virtual Methods?

    No,

    moreover, you cannot access private methods in inherited classes, have to be protected in the base class to allow any sort of access.

  • Can You Prevent Your Class From Being Inherited And Becoming A Base Class For Some Other Classes?

    Yes,

    that’s what keyword sealed in the class definition is for. The developer trying to derive from your class will get a message: cannot inherit from Sealed class WhateverBaseClassName. It’s the same concept as final class in Java.

  • Can You Allow Class To Be Inherited, But Prevent The Method From Being Over-ridden?

    Yes,

    just leave the class public and make the method sealed.

  • What Is An Abstract Class?

    A class that cannot be instantiated. A concept in C++ known as pure virtual method. A class that must be inherited and have the methods over-ridden. Essentially, it is a blueprint for a class without any implementation.

  • When Do You Absolutely Have To Declare A Class As Abstract (as Opposed To Free-willed Educated Choice Or Decision Based On Uml Diagram)?

    When at least one of the methods in the class is abstract. When the class itself is inherited from an abstract class, but not all base abstract methods have been over-ridden.

  • What Is An Interface Class?

    It is an abstract class with public abstract methods all of which must be implemented in the inherited classes.

  • Why Can't You Specify The Accessibility Modifier For Methods Inside The Interface?

    They all must be public. Therefore, to prevent you from getting the false impression that you have any freedom of choice, you are not allowed to specify any accessibility, its public by default.

  • Can You Inherit Multiple Interfaces?

    Yes,

  • And If They Have Conflicting Method Names?

    It’s up to you to implement the method inside your own class, so implementation is left entirely up to you. This might cause a problem on a higher-level scale if similarly named methods from different interfaces expect different data.

  • What Is The Difference Between An Interface And Abstract Class?

    In the interface all methods must be abstract; in the abstract class some methods can be concrete. In the interface no accessibility modifiers are allowed, which is ok in abstract classes.

  • How Can You Overload A Method?

    Different parameter data types, different number of parameters, different order of parameters.

  • If A Base Class Has A Bunch Of Overloaded Constructors, And An Inherited Class Has Another Bunch Of Overloaded Constructors, Can You Enforce A Call From An Inherited Constructor To An Arbitrary Base Constructor?

    Yes,

    just place a colon, and then keyword base (parameter list to invoke the appropriate constructor) in the overloaded constructor definition inside the inherited class.

  • What Is The Difference Between System.string And System.stringbuilder Classes?

    System.String is immutable; System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.

  • What Is The Advantage Of Using System.text.stringbuilder Over System.string?

    StringBuilder is more efficient in the cases, where a lot of manipulation is done to the text. Strings are immutable, so each time it’s being operated on, a new instance is created.

  • Can You Store Multiple Data Types In System.array?

    No.

  • What Is The Difference Between The System.array.copyto() And System.array.clone()?

    The first one performs a deep copy of the array, the second one is shallow.

  • How Can You Sort The Elements Of The Array In Descending Order?

    By calling Sort() and then Reverse() methods.

  • What Is The .net Datatype That Allows The Retrieval Of Data By A Unique Key?

    HashTable.

  • What Is Class Sortedlist Underneath?

    A sorted HashTable.

  • Will Finally Block Get Executed If The Exception Had Not Occurred?

    Yes.

  • What Is The C# Equivalent Of C++ Catch (....), Which Was A Catch-all Statement For Any Possible Exception?

    A catch block that catches the exception of type System.Exception. You can also omit the parameter data type in this case and just write catch {}.

  • Can Multiple Catch Blocks Be Executed?

    No,

    once the proper catch code fires off, the control is transferred to the finally block (if there are any), and then whatever follows the finally block.

  • Why Is It A Bad Idea To Throw Your Own Exceptions?

    Well, if at that point you know that an error has occurred, then why not write the proper code to handle that error instead of passing a new Exception object to the catch block? Throwing your own exceptions signifies some design flaws in the project.

  • What Is A Delegate?

    A delegate object encapsulates a reference to a method. In C++ they were referred to as function pointers.

  • What Is A Multicast Delegate?

    It is a delegate that points to and eventually fires off several methods.

  • How Is The Dll Hell Problem Solved In .net?

    Assembly versioning allows the application to specify not only the library it needs to run (which was available under Win32), but also the version of the assembly.

  • What Is A Satellite Assembly?

    When you write a multilingual or multi-cultural application in .NET, and want to distribute the core application separately from the localized modules, the localized assemblies that modify the core application are called satellite assemblies.

  • What's The Difference Between // Comments, /* */ Comments And /// Comments?

    Single-line, multi-line and XML documentation comments.

  • How Do You Generate Documentation From The C# File Commented Properly With A Command-line Compiler?

    Compile it with a /doc switch.

  • What Is The Difference Between <c> And <code> Xml Documentation Tag?

    Single line code example and multiple-line code example.

  • Is Xml Case-sensitive?

    Yes,

    so <Student> and <student> are different elements.

  • What Debugging Tools Come With The .net Sdk?

    CorDBG – command-line debugger, and DbgCLR – graphic debugger. Visual Studio .NET uses the DbgCLR. To use CorDbg, you must compile the original C# file using the /debug switch.

  • What Does The This Window Show In The Debugger?

    It points to the object that is pointed to by this reference. Object is instance data is shown.

  • What Does Assert() Do?

    In debug compilation, assert takes in a Boolean condition as a parameter, and shows the error dialog if the condition is false. The program proceeds without any interruption if the condition is true.

  • What Is The Difference Between The Debug Class And Trace Class? Documentation Looks The Same?

    Use Debug class for debug builds, use Trace class for both debug and release builds.

  • Why Are There Five Tracing Levels In System.diagnostics.traceswitcher?

    The tracing dumps can be quite verbose and for some applications that are constantly running you run the risk of overloading the machine and the hard drive there. Five levels range from None to Verbose, allowing to fine-tune the tracing activities.

  • Where Is The Output Of Textwritertracelistener Redirected?

    To the Console or a text file depending on the parameter passed to the constructor.

  • How Do You Debug An Asp.net Web Application?

    Attach the aspnet_wp.exe process to the DbgClr debugger.

  • What Are Three Test Cases You Should Go Through In Unit Testing?

    Positive test cases (correct data, correct output), negative test cases (broken or missing data, proper handling), exception test cases (exceptions are thrown and caught properly).

  • Can You Change The Value Of A Variable While Debugging A C# Application?

    Yes,

    if you are debugging via Visual Studio.NET, just go to Immediate window.

  • Explain The Three Services Model (three-tier Application)?

    Presentation (UI), business (logic and underlying code) and data (from storage or other sources).

  • What Are Advantages And Disadvantages Of Microsoft-provided Data Provider Classes In Ado.net?

    SQLServer.NET data provider is high-speed and robust, but requires SQL Server license purchased from Microsoft. OLE-DB.NET is universal for accessing other sources, like Oracle, DB2, Microsoft Access and Informix, but it is a .NET layer on top of OLE layer, so not the fastest thing in the world. ODBC.NET is a deprecated layer provided for backward compatibility to ODBC engines.

  • What Is The Role Of The Datareader Class In Ado.net Connections?

    It returns a read-only dataset from the data source when the command is executed.

  • What Is The Wildcard Character In Sql? Let's Say You Want To Query Database With Like For All Employees Whose Name Starts With La.

    The wildcard character is %, the proper query with LIKE would involve ‘La%’.

  • Explain Acid Rule Of Thumb For Transactions.

    Transaction must be Atomic (it is one unit of work and does not dependent on previous and following transactions), Consistent (data is either committed or roll back, no “in-between” case where something has been updated and something hasn’t), Isolated (no transaction sees the intermediate results of the current transaction), Durable (the values persist if the data had been committed even if the system crashes right after).

  • What Connections Does Microsoft Sql Server Support?

    Windows Authentication (via Active Directory) and SQL Server authentication (via Microsoft SQL Server user name and passwords).

  • Which One Is Trusted And Which One Is Untrusted?

    Windows Authentication is trusted because the username and password are checked with the Active Directory, the SQL Server authentication is untrusted, since SQL Server is the only verifier participating in the transaction.

  • Why Would You Use Untrusted Verificaion?

    Web Services might use it, as well as non-Windows applications.

  • What Does The Parameter Initial Catalog Define Inside Connection String?

    The database name to connect to.

  • What Is The Data Provider Name To Connect To Access Database?

    Microsoft.Access.

  • What Does Dispose Method Do With The Connection Object?

    Deletes it from the memory.

  • What Is A Pre-requisite For Connection Pooling?

    Multiple processes must agree that they will share the same connection, where every parameter is the same, including the security settings.

  • What Is Ado.net?

    ADO.NET is a part of the Microsoft .NET Framework. This framework provides the set of classes that deal with data communication between various layers of the software architecture and the database. It provides a continuous access to different data source types such as SQL Server versions 7, 2000, 2005. It also provides connectivity options to data sources through OLE DB and XML. Connectivity may be established with other databases like Oracle, MySQL etc. as well.

    ADO.NET has the ability to separate data access mechanisms, data manipulation mechanisms and data connectivity mechanisms.

    ADO.NET introduces along with it the disconnected architecture. In a disconnected architecture, data may be stored in a DataSet. It contains providers for connecting to databases, commands for execution and retrieval of results.

    The classes for ADO.NET are stored in the DLL System.Data.dll.

  • Can We Connect Two Dataadapters To Same Data Source Using Single Connection At Same Time?

    yes,

    we can connect two dataadapters to same datasource using single connection at same time.
    There is a technology in ado.net 2.0 called MARS usinng Mars in connection string we can do it.

    for eg:

    cn.ConnectionString = "server=(local); database=employee; integrated security=sspi; Multiple Active Result Sets=True";

  • Can We Do Database Operations Without Using Any Of The Ado.net Objects?

    No,

    its not at all possible.

  • If We Are Not Returning Any Records From The Database, Which Method Is To Be Used?

     There is a method called Execute Non Query. This method executes the Update, Delete etc. This does not return any rows but will give the number of rows affected.

     

  • How Can I Retrieve Two Tables Of Data At A Time By Using Data Reader?

    If we execute 2 select command either in stored procedure or in select command and then executereader method fired of command object. it return 2 tables in datareader.

    E.g:
    string str="Select * from a;select * from b";
    cmd.commandtext=str;
    dr=cmd.executereader();

    Now it return 2 tables in datareader (dr).

  • Explain Executenonquery?

     Summary:

     Executes a Transact-SQL statement against the connection and returns the number of rows affected.
     

  • What Is The Executescalar Method?

     Summary:

    Executes the query, and returns the first column of the first row in the result set returned by the query. Additional columns or rows are ignored.

     

  • Which One Of The Following Objects Is A High-level Abstraction Of The Connection And Command Objects In Ado.net?

    DataReader DataSet DataTable DataView DataAdapter

    Answer: DataAdapter

  • How Can We Load Multiple Tables In To Dataset?

    DataSet ds=new DataSet();
    SqlDataAdapter dap=new 
    SqlDataAdapter(Select * from <tablename>,<connection1>);
    dap.Fill(ds,"TableOne");
    SqlDataAdapter dap1=new SqlDataAdapter(Select * from <tablename>,<connection1>);
    dap1.Fill(ds,"tableTwo");
  • What Is Connection String?

    connection String - a string which contains address of the database we want to connect to.

  • What Is Delegate?

    Delegate is an important element of C# and is extensively used in every type of .NET application. A delegate is a class whose object (delegate object) can store a set of references to methods.

  • How Do You Update A Dataset In Ado.net And How Do You Update Database Through Dataset?

    Update a dataset:

    Dataset ds = new dataset();
    SqlDataAdapter adp = new SqlDataAdapter(Query,connection);
    Adp.fill(ds);
    Again you can add/update Dataset as below
    SqlDataAdapter adp1 = new SqlDataAdapter(Query1,connection);
    Adp1.fill(ds);

    Update database through dataset.

    SqlCommandBuilder mySqlCommandBuilder = new
    SqlCommandBuilder(mySqlDataAdapter);
    Foreach(datarow dr in ds.table[0].rows)
    {
    Dr[“column Name”] = “value”;
    mySqlDataAdapter.Update(ds);
    }
  • What Are The Steps To Connect To A Database?

    1. Create a connection. This requires a connection string, which can be given declaratively or put in a well defined place like the .config files. Advantage of keeping in .config files is that it enables use of Connection Pooling by .Net framework, else even one small change in connection string will cause CLR to think it's not the same connection and will instantiate new connection for other request.
    2. Open the connection and keep it open until done, typically done as using (con) { //use }
    3. If using connected data model, create a SqlCommand object, decorate it with desired command, command type (stored procedure for eg), add any parameters and their values to the command, and then consume the command by using ExcuteReader or ExecuteScalar. In case of ExecuteReader, we will get back a handle to a fast-forward, read only pointer to the recordset. We can also decorate Command object with multiple recordsets in 2.0 and execute one by one (MARS - Multiple Active Record Sets)
    4. If using disconnected data model, create a DataAdapter object, decorate it with desired SELECT, INSERT, UPDATE, DELETE commands, add parameters as necessary and then fill up a DataSet or DataTable using the DataAdapter. Subsequent SQL can be executed using insert, update, delete commands on the dataset.
  • How Do You Connect To Sql Server Database Without Using Sqlclient?

    you can connect sql using oledbname space.

  • What Is Partial Class?

    A Partial class is a class that can be split into two or more classes. This means that a class can be physically separated into other parts of the class within the same namespace. All the parts must use the partial keyword. All the other classes should also have the same access modifier. At the compile time, all the partial classes will be treated as a single class. Let us list some advantages of having partial classes.

  • What Are The Advantages And Disadvantages Of Using Datalist?

    Adv: The DataList's display is defined via templates, DataList allows for much more customization of the rendered HTML markup, by which it is more user-friendly displays of data.

    DisAdv:

    adding such functionality with the DataList takes more development time than with the DataGrid as,

    1. The Edit/Update/Cancel buttons that can be created in a DataGrid via the EditCommandColumn column type, must be manually added to the DataList and,
    2. The DataGrid BoundColumn column types automatically use a TextBox Web control for the editing interface, whereas with the DataList you must explicitly specify the editing interface for the item being edited via the EditItemTemplate,
    3. we can't do the paging and sorting with datalist controls.
  • What Is The Difference Between Data Reader And Data Adapter?

    DataReader is an forward only and read only cursor type if you are accessing data through DataReader it shows the data on the web form/ control but you can not perform the paging feature on that record (because it's forward only type). Reader is best fit to show the Data (where no need to work on data) DataAdapter is not only connect with the Databse(through Command object) it provide four types of command (InsertCommand, UpdateCommand, DeleteCommand, SelectCommand), It supports to the disconnected Architecture of .NET show we can populate the records to the DataSet, where as Dataadapter is best fit to work on data.

  • What Is The Difference Between Data Reader And Data Set?

    1. DataSet is disconnected object type. It uses XML to store data.
    2. It fetches all data from the data source at a time
    3. Modifications can be updated to the actual database
    4. It will reduce the application performance.
  • Does Sqlclient And Oledb Class Share The Same Functionality?

    No,

    each have its own functionality,

    ex : for sql client , there is SqlConnection object and for oledb client , there is OleDBConnection

  • Why Edit Is Not Possible In Repeater?

    It has no such feature.

  • Difference Between Sqlcommand And Sqlcommandbuilder?

    • SQLCommand is used to execute all kind of SQL queries like DML(Insert, update,Delete) & DDL like(Create table, drop table etc),
    • SQLCommandBuilder object is used to build & execute SQL (DML) queries like select, insert, update & delete.
  • Why Cannot We Use Multiple Inheritance And Garbage Collector Paralelly In .net?

    .Net doesn't support the mutiple inheritance, perhaps you may talk about multi-level inheritance.

    In the later case, if a class is inherited from another class, at the time of creating instance, it will obviously give a call to its base class constructor (ie bottom - top approach). Like wise the constructor execution is takes place in top down approach (ie. base class constructor is executed and the derived class constructor is executed).

    So for GC,  it will collect only when an object does not have any reference. As we see previously, the derived is constructed based on base class. There is a reference is set to be. Obviously GC cannot be collected.

  • How To Find The Given Query Is Optimised One Or Not?

    First Execute Sql Queries in Query Analzer,see How much time it take to Execute , if it is Less then the your desired Time, then it will Optimize query.

  • How To Copy The Contents From One Table To Another Table And How To Delete The Source Table In Ado.net?

    DataSet ds;
    sqlAdap.Fill(ds);
    Datatable dt = ds.Tables[0].copy();
    //now the structure and data are copied into 'dt'
    ds.Tables.remove(ds.Table[0]);
    //now the source is removed from the 'ds'
  • How To Call The Sql Commands Asynchronously In Ado.net Version 2.0?

    executescalar()
    executereader()
    executenonquery()

    These comes with Begin and End like Beginexecutescalr() Endexecutescalar()....... by using these command we can achieve asynchronous command in ado.net.

  • What Is Typed And Untyped Dataset?

    A DataSet can be Typed or Untyped. The difference between the two lies in the fact that a Typed DataSet has a schema and an Untyped DataSet does not have one. It should be noted that the Typed Datasets have more support in Visual studio.

  • I Loaded The Dataset With A Table Of 10 Records. One Of The Records Is Deleted From The Backend, How Do You Check Whether All The 10 Records Were Present While Updating The Data(which Event And Steps) And Throw The Exception.

    By Using the Transactions we can check the Exact Numbers of the rows to be updated and if the updation fails then the Transaction will be rollbacked.

  • Can Datareader Hold Data From Multiple Tables?

    data reader can hold data from multiple tables and datareader can hold more than one table.

    string query="select * from employee; select * from student";
    sqlcommand cmd=new sqlcommand(query, connection);
    sqldatareader dr=cmd.executeReader();
    if(dr.hasrows)
    {
    dr.read();
    gridview1.DataSource=dr;
    gridview1.Databind();
    if(dr.nextresult)
    {
    gridview2.datasource=dr;
    gridview2.databind();
    }
    }
    dr.colse();
    connection.close();
  • What Is Different Between Sqlcommand Object And Command Behavior Object?

    ADO.NET Command Object - The Command object is similar to the old ADO command object.

    It is used to store SQL statements that need to be executed against a data source.

    The Command object can execute SELECT statements, INSERT, UPDATE, or DELETE statements, stored procedures, or any other statement understood by the database.

  • What Is Bubbled Event Can You Explain?

    All heavy controls like grid view, datagrid or datalist, repeater controls cantains the child controls like button or link button, when we click this button then the event will be raised, that events are handled by parent controls, that is called event bubbling, means event is bubbled from bottom (child) to up (parent).

  • If A Table Contains 20000 Records. In A Page At Each Time 100 Records To Be Displayed. What Are The Steps You Will Take To Improve Performance? Will You Use Dataset Or Datareader?

    we have to use a dataset because on using datareader forward only paging can be achieved. Suppose if you are at 1000 page and you want to go back to 999th page, if you use datareader it cannot be achieved, since it does not support backward navigation. Dataset supports forward and backward navigation.

  • What Are The Different Row Versions Available In Table?

    There are four types of Rowversions.

    Current:
    The current values for the row. This row version does not exist for rows with a RowState of Deleted.

    Default :
    The row the default version for the current DataRowState. For a DataRowState value of Added, Modified or Current, the default version is Current. For a DataRowState of Deleted, the version is Original. For a DataRowState value of Detached, the version is Proposed.

    Original:
    The row contains its original values.

    Proposed:
    The proposed values for the row. This row version exists during an edit operation on a row, or for a row that is not part of a DataRowCollection.

  • What Are The Two Fundamental Objects In Ado.net?

    Datareader and Dataset are the two fundamental objects in ADO.NET.

  • What We Do With The Object Of Ado.net Dataset After Using It?can We Dispose It Or Can We Set It Nothing?is It Must Or Not?

    we use dispose.

  • What Provider Ado.net Use By Default?

    Ado.net uses no Dataprovider by default.

  • What Is The Provider And Namespaces Being Used To Access Oracle Database?

    The provider name is oledb and the namespace is system.data.oledb

  • Explain Acid Properties?

    The term ACID conveys the role transactions play in mission-critical applications. Coined by transaction processing pioneers, ACID stands for atomicity, consistency, isolation, and durability.

    These properties ensure predictable behavior, reinforcing the role of transactions as all-or-none propositions designed to reduce the management load when there are many variables.

  • What Is Atomicity?

    A transaction is a unit of work in which a series of operations occur between the BEGIN TRANSACTION and END TRANSACTION statements of an application. A transaction executes exactly once and is atomic ?

    all the work is done or none of it is.

    Operations associated with a transaction usually share a common intent and are interdependent.
    By performing only a subset of these operations, the system could compromise the overall intent of the transaction. Atomicity eliminates the chance of processing a subset of operations.

  • What Is Isolation?

    A transaction is a unit of isolation ? allowing concurrent transactions to behave as though each were the only transaction running in the system.

    Isolation requires that each transaction appear to be the only transaction manipulating the data store, even though other transactions may be running at the same time. A transaction should never see the intermediate stages of another transaction.

    Transactions attain the highest level of isolation when they are serializable. At this level, the results obtained from a set of concurrent transactions are identical to the results obtained by running each transaction serially.

    Because a high degree of isolation can limit the number of concurrent transactions, some applications reduce the isolation level in exchange for better throughput.

  • What Is Data Adapter?

    Data adapter is bridge between Connection and DataSet , Data adapter in passing the sql query and fill in dataset.

  • How To Find The Count Of Records In A Dataset?

    DS.Tables["tabname"].Rows.Count;

    we can get count of the records.

  • What Are Design Patterns? Define Basic Classification Of Patterns?

    A design pattern in Software is used to solve similar problems that occur in different scenarios.

  • What Is The Difference Between Factory And Abstract Factory Patterns?

    The difference between Factory and Abstract Factory Patterns lies in object instantiation. In Abstract factory pattern Composition.

  • What Is Mvc Pattern?

    Model View Controller is used to separate the interface from the business logic so as to give a better visual appearance.

  • How Can We Implement Singleton Pattern In .net?

    Singleton pattern restricts only one instance running for an object.

  • How Do You Implement Prototype Pattern In .net?

    Prototype pattern is used to create copies of original instances known as clones. It is used when creating instances of a class is very complex.

  • What Is Aspect Oriented Programming? What Is Cross Cutting In Aop?

    Aspect-Oriented Programming (AOP), also named Aspect-Oriented Software Development (AOSD), is an approach to software development that goes further in the direction of separation of concerns. Separation of concerns is one of the most important rules in software development. It states that the same concern should be solved in a single unit of code. This is also called modularization. In procedural programming, the unit of code is the procedure (or function, or method). In object-oriented programming, the unit of code is the class. Some concerns cannot be implemented successfully using a pure procedural or object-oriented programming.

    An example is code security. If you want to secure objects and methods, you have to modify the code of each method. That's why security is said a crosscutting concern, because it crosscuts the unit of modularization of the programming paradigm, in this case the class. An aspect is a concern that cross-cuts many classes and/or methods. So AOP is a technique that allows to address issues that cross-cuts objects. AOP is frequently used to implement caching, tracing, security or failure injections.

  • What Is Windows Dna Architecture?

    Windows Distributed internet Applications architecture provides a robust, efficient solution to enable Windows platform.

  • What Is Service Oriented Architecture?

    Service oriented architecture is based on services. Service is a unit of some task performed by a service provider in order to satisfy the consumer.

  • What Is Three Tier Architecture?

    Three tier architecture typically consists of a client, server and “agent” between them. The agent is responsible for gathering the results and returning a single response to the agent. Such architecture increases performance, reusability and scalability of the application.

  • Explain The Situations You Will Use A Web Service And Remoting In Projects?

    Web services should be used if the application demands communication over a public network and require to work across multiple platforms. Remoting is faster comparatively and hence can be used in .Net components when performance is a high priority. Few applications can also make use of BOTH web services and Remoting to send and receive data not just across multiple platforms but also between .Net applications where performance and speed is a key priority.

  • Overview Of Ado.net Architecture?

     Data Provider provides objects through which functionalities like opening and closing connection, retrieving and updating data can be availed.It also provides access to data source like SQL Server, Access, and Oracle.

    Some of the data provider objects are:

    • Command object which is used to store procedures.
    • Data Adapter which is a bridge between datastore and dataset.
    • Datareader which reads data from data store in forward only mode.
    • A dataset object is not in directly connected to any data store. It represents disconnected and cached data.

    The dataset communicates with Data adapter that fills up the dataset. Dataset can have one or more Datatable and relations.  

     

  • .net Framework?

    This includes introduction of .Net framework, .Net framework architecture, role of assembly and GAC.

  • Asp.net 2.0 Web Parts Framework?

    ASP.NET 2.0 ships with a Web Parts Framework that provides the infrastructure and the building blocks required for creating modular web pages that can be easily customized by the users. You can use Web Parts to create portal pages that aggregate different types of content, such as static text, links, and content that can change at runtime.

  • .net Assembly?

    This article explains .Net assembly, private and shared assembly, satellite assemblies, resource-only assembly, ResourceManager class, strong name, global assembly cache.

  • Model View Controller?

    we will learn about MVC design patterns, and how Microsoft has made our lives easier by creating the ASP.NET MVC framework for easier adoption of MVC patterns in our web applications.

  • Differences Between "dataset"and "datareader"?

    DataSet object can contain multiple rowsets from the same data source as well as from the relationships between them.

  • What Is Microsoft Ado.net?

    Visual Studio .NET provides access to databases through the set of tools and namespaces collectively referred to as Microsoft ADO.NET.

  • What Are The 3 Major Types Of Connection Objects In Ado.net?

    OleDbConnection object : Use an OleDbConnection object to connect to a Microsoft Access or third-party database, such as MySQL. OLE database connections use the OleDbDataAdapter object to perform commands and return data.

    SqlConnection object : Use a SqlConnection object to connect to a Microsoft SQL Server database. SQL database connections use the SqlDataAdapter object to perform commands and return data.

    OracleConnection object : Use an OracleConnection object to connect to Oracle databases. Oracle database connections use the OracleDataAdapter object to perform commands and return data. This connection object was introduced in Microsoft .NET Framework version 1.1.

  • List The 4 Common Ado.net Namespaces?

    System.Data : Contains Classes, types, and services for creating and accessing data sets and their subordinate objects.

    System.Data.SqlClient : Contains Classes and types for accessing Microsoft SQL Server databases.

    System.Data.OracleClient : Contains Classes and types for accessing Oracle databases (Microsoft .NET Framework version 1.1 and later).

    System.Data.OleDb : Contains Classes and types for accessing other databases.

  • List All The Steps In Order, To Access A Database Through Ado.net?

    1. Create a connection to the database using a connection object.
    2. Invoke a command to create a DataSet object using an adapter object.
    3.  Use the DataSet object in code to display data or to change items in the database.
    4.  Invoke a command to update the database from the DataSet object using an adapter object.
    5. Close the database connection if you explicitly opened it in step 2 using the Open method. Invoking commands without first invoking the Open method implicitly opens and closes the connection with each request.
  • Why Will You Usually Create An Aspnet User Account In The Database For An Asp.net Web Application?

    Web applications run using the ASPNET user account. The SQL database administrator will have to set up this account and grant it permissions before your Web application will have access to a SQL database. For file-based databases, such as Microsoft Access, you must grant permissions on the database file to the ASPNET user account using Windows file security settings.

  • What Is The Difference Between Datareader And Dataadapter?

    1. Data Reader is read only forward only and much faster than DataAdapter.
    2. If you use DataReader you have to open and close connection explicitly where as if you use DataAdapter the connection is automatically opened and closed.
    3. DataReader is connection oriented where as Data Adapter is disconnected.
  • Can You Inherit From Sqlconnection Class?

    No,

    you cannot inheirt from SqlConnection Class. SqlConnection Class is a sealed class. It is a compile time error.

  • Will The Connection Be Closed, If The Sqlconnection Object Goes Out Of Scope?

    No,

    If the SqlConnection goes out of scope, it won't be closed. Therefore, you must explicitly close the connection by calling Close or Dispose.

  • What Happens If Connection Pooling Is Enabled?

    If connection pooling is enabled and when you call Close or Dispose methods, then the connection is returned to the connection pool. This connection can then be resused.If connection pooling is disabled and when you call Close or Dispose methods, the underlying connection to the server is actually closed.

  • How Do You Ensure That The Database Connections Are Always Closed?

    To ensure that the database connections are always closed, open the connection inside of a using block, as shown in the following code fragment. Doing so ensures that the connection is automatically closed when the code exits the block.

    using (SqlConnection ConnectionObject = new SqlConnection())
    {
    ConnectionObject.Open();
    //The database connection will be closed when the control exits the using code block
    }

  • How Do You Read An Xml File Into A Dataset?

    Using the DataSet object’s ReadXML method.

  • When Do You Use Executereader, Executenonquery, Executescalar Methods?

    If the command or stored procedure that is being executed returns a set of rows, then we use ExecuteReader method.

    If the command or stored procedure that is being executed returns a single value then we use ExecuteScalar method.

    If the command or stored procedure performs INSERT, DELETE or UPDATE operations, then we use ExecuteNonQuery method.

    ExecuteNon Query method returns an integer specifying the number of rows inserted, deleted or updated.

  • Can Your Class Inherit From Sqlcommand Class?

    No,

    you cannot inheirt from SqlCommand Class. SqlCommand Class is a sealed class. It is a compile time error.

  • Give An Example That Shows How To Execute A Stored Procedure In Ado.net?

    using (SqlConnection ConnectionObject = new SqlConnection())
    {
    //Specify the name of the stored procedure to execute and the 
    Connection Object to use.
    SqlCommand CommandObject = new SqlCommand("StoredProcedureName", ConnectionObject);
    //Specify the SQL Command type is a stored procedure
    CommandObject.CommandType = CommandType.StoredProcedure;
    //Open the connection
    ConnectionObject.Open();
    //Execute the Stored Procedure
    int RecordsAffected = CommandObject.ExecuteNonQuery();
    }
  • Can You Reuse A Sqlcommand Object?

    Yes,

    you can reset the CommandText property and reuse the SqlCommand object.

  • What Are The Methods That Can Ensure Asynchronous Execution Of The Transact-sql Statement Or Stored Procedure?

    • BeginExecuteNonQuery,
    • BeginExecuteReader.
  • What Is Sqlcommand.commandtimeout Property Used For?

    CommandTimeout Property is used to Get or set the wait time before terminating the attempt to execute a command and generating an error.

    //Specify the CommandTimeout property value
    SqlCommand CommandObject = new SqlCommand("StoredProcedureName", ConnectionObject);
    //Wait for 10 seconds to execute the Stored procedure
    CommandObject.CommandTimeout = 10;
    The time is in seconds. The default is 30 seconds.
  • How Do You Create An Instance Of Sqldatareader Class?

    To create an instance of SqlDataReader class, you must call the ExecuteReader method of the SqlCommand object, instead of directly using a constructor.

    //Error! Cannot use SqlDataReader() constructor to create
     an instance of SqlDataReader class.
    SqlDataReader ReaderObject = new SqlDataReader();
    
    //Call the ExecuteReader method of the SqlCommand object
    SqlCommand CommandObject = new SqlCommand();
    SqlDataReader ReaderObject = CommandObject.ExecuteReader();

    Creating an instance of SqlDataReader class using SqlData Reader() constructor generates a compile time error - The type 'System.Data.SqlClient.SqlDataReader' has no constructors defined.

  • How Do You Programatically Check If A Specified Sqldatareader Instance Has Been Closed?

    Use the IsClosed property of SqlDataReader to check if a specified SqlDataReader instance has been closed. If IsClosed property returns true, the SqlDataReader instance has been closed else not closed.

  • How Do You Get The Total Number Of Columns In The Current Row Of A Sqldatareader Instance?

    FieldCount property can be used to get the total number of columns in the current row of a SqlData Reader instance.

  • What Is The Use Of Sqlparameter.direction Property?

    SqlParameter.Direction Property is used to specify the Sql Parameter type - input-only, output-only, bidirectional, or a stored procedure return value parameter. The default is Input.

  • What Are The Advantages Of Using Sql Stored Procedures Instead Of Adhoc Sql Queries In An Asp.net Web Application?

    Better Performance : As stored procedures are precompiled objects they execute faster than SQL queries. Every time we run a SQL query, the query has to be first compiled and then executed where as a stored procedure is already compiled. Hence executing stored procedures is much faster than executing SQL queries.

    Better Security: For a given stored procedure you can specify who has the rights to execute. You cannot do the same for an SQL query. Writing the SQL statements inside our code is usually not a good idea. In this way you expose your database schema (design) in the code which may be changed. Hence most of the time programmers use stored procedures instead of plain SQL statements.

    Reduced Network Traffic : Stored Procedures reside on the database server. If you have to execute a Stored Procedure from your ASP.NET web application you just specify the name of the Stored Procedure. So over the network you just send the name of the Stored Procedure. With an SQL query you have to send all the SQL statements over the network to the database server which could lead to increased network traffic.

  • Can You Update The Database Using Datareader Object?

    No,

    You cannot update the database using DataReader object. DataReader is read-only, foward only. It reads one record at atime. After DataReader finishes reading the current record, it moves to the next record. There is no way you can go back to the previous record.

  • What Is The Difference Between A Datareader And A Dataset?

    DataReader

    1. DatReader works on a Connection oriented architecture.
    2. DataReader is read only, forward only. It reads one record at atime. After DataReader finishes reading the current record, it moves to the next record. There is no way you can go back to the previous record. So using a DataReader you read in forward direction only.
    3. Updations are not possible with DataReader.
    4. As DataReader is read only, forward only it is much faster than a DataSet.

    DataSet

    1. DataSet works on disconnected architecture.
    2. Using a DataSet you can move in both directions. DataSet is bi directional.
    3. Database can be updated from a DataSet.
    4. DataSet is slower than DataReader.
  • Give An Example Scenario Of Using A Dataset And A Datareader?

    If you want to just read and display the data(No updates, deletes, or inserts) then use a DataReader.
    If you want to do a batch inserts, updates and deletes then use a DataSet.

  • What Are The Two Fundamental Objects In Ado.net ?

    Datareader and Dataset are the two fundamental objects in ADO.NET.

  • What Is Difference Between Dataset And Datareader ?

    Following are some major differences between dataset and datareader :-  DataReader provides forward-only and read-only access to data, while the DataSet object can hold more than one table (in other words more than one rowset) from the same data source as well as the relationships between them. Dataset is a disconnected architecture while datareader is connected architecture.  Dataset can persist contents while datareader can not persist contents, they are forward only.

  • What Are Major Difference Between Classic Ado And Ado.net ?

    Following are some major differences between classic ADO and ADO.NET: Both As in classic ADO we had client and server side cursors they are no more present in ADO.NET. Note it's a disconnected model so they are no more applicable. Locking is not supported due to disconnected model. All data persist in XML as compared to classic ADO where data persisted in Binary format also.

  • What Is The Use Of Connection Object ?

    They are used to connect a data to a Command object. An OleDb Connection object is used with an OLE-DB provider255 A SqlConnection object uses Tabular Data Services (TDS) with MS SQL Server.

  • What Is The Use Of Command Objects ?

    They are used to connect connection object to Datareader or dataset. Following are the methods provided by command object :-

    ExecuteNonQuery :- Executes the command defined in the CommandText property against the connection defined in the Connection property for a query that does not return any row (an UPDATE, DELETE or INSERT). Returns an Integer indicating the number of rows affected by the query.

    ExecuteReader :- Executes the command defined in the CommandText property against the connection defined in the Connection property. Returns a "reader" object that is connected to the resulting rowset within the database, allowing the rows to be retrieved.

    ExecuteScalar :- Executes the command defined in the CommandText property against the connection defined in the Connection property. Returns only single value (effectively the first column of the first row of the resulting rowset) any other returned columns and rows are discarded. It is fast and efficient when only a "singleton" value is required.

  • What Is The Use Of Dataadapter ?

    These are objects that connect one or more Command objects to a Dataset object. They provide logic that would get data from the data store and populates the tables in the DataSet, or pushes the changes in the DataSet back into the data store.An OleDbDataAdapter object is used with an OLE-DB provider A SqlDataAdapter object uses Tabular Data Services with MS SQL Server.

  • What Are Basic Methods Of Dataadapter ?

    There are three most commonly used methods of Dataadapter :-

    Fill :- Executes the SelectCommand to fill the DataSet object with data from the data source. It an also be used to update (refresh) an existing table in a DataSet with changes made to the data in the original datasource if there is a primary key in the table in the DataSet.

    FillSchema :- Uses the SelectCommand to extract just the schema for a table from the data source, and creates an empty table in the DataSet object with all the corresponding constraints.

    Update:- Calls the respective InsertCommand, UpdateCommand, or DeleteCommand for each inserted, updated,or deleted row in the DataSet so as to update the original data source with the changes made to the content of the DataSet. This is a little like the UpdateBatch method provided by the ADO Recordset object, but in the DataSet it can be used to update more than one table.

  • What Is Dataset Object?

    The DataSet provides the basis for disconnected storage and manipulation of relational data. We fill it from a data store, work with it while disconnected from that data store, then reconnect and flush changes back to the data store if required.

  • What Are The Various Objects In Dataset ?

    Dataset has a collection of DataTable object within the Tables collection. Each DataTable object contains a collection of DataRow objects and a collection of DataColumn objects. There are also collections for the primary keys, constraints, and default values used in this table which is called as constraint collection, and the parent and child relationships between the tables. Finally, there is a DefaultView object for each table. This is used to create a DataView object based on the table, so that the data can be searched, filtered or otherwise manipulated while displaying the data.

  • How Can We Force The Connection Object To Close After My Datareader Is Closed ?

    Command method Executereader takes a parameter called as CommandBehavior where in we can specify saying close connection automatically after the Datareader is close.

    pobjDataReader = pobj Command .Execute Reader (CommandBehavior.CloseConnection)

  • I Want To Force The Datareader To Return Only Schema Of The Datastore Rather Than Data ?

    pobjDataReader = pobjCommand.ExecuteReader(CommandBehavior.SchemaOnly).

  • How Can We Fine Tune The Command Object When We Are Expecting A Single Row ?

    Again CommandBehaviour enumeration provides two values SingleResult and SingleRow. If you are expecting a single value then pass “CommandBehaviour.SingleResult” and the query is optimized accordingly, if you are expecting single row then pass “CommandBehaviour.SingleRow” and query is optimized according to single row.

  • Which Is The Best Place To Store Connectionstring In .net Projects ?

    264 Config files are the best places to store connectionstrings. If it is a web-based application “Web.config” file will be used and if it is a windows application “App.config” files will be used.

  • What Are The Various Methods Provided By The Dataset Object To Generate Xml?

    XML is one of the most important leap between classic ADO and ADO.NET.

     ReadXML: Read’s a XML document in to Dataset.

    GetXML: This is a function which returns the string containing XML document.

    WriteXML: This writes a XML data to disk.

  • How Can We Save All Data From Dataset ?

    // create the data adapter
    SqlDataAdapter dataAdapter = new
    SqlDataAdapter ("SELECT userId,username FROM users ORDER BY username",
    sqlConn);
    // create an SqlCommandBuilder - this will automatically generate the
    commands, and set the appropriate properties in the dataAdapter
    SqlCommandBuilder commandBuilder = new
    SqlCommandBuilder(dataAdapter);
    // create the DataSet
    DataSet dataSet = new DataSet();
    // fill the DataSet using our DataAdapter into a table called users
    dataAdapter.Fill (dataSet,"users");
    // set the DataGrid source to the one table in our dataset
    myDataGrid.DataSource = dataSet.Tables[0];

    Then, when we've finished making our changes  to the DataSet via the DataGrid, we call

    dataAdapter.Update(dataSet); 

    and the database will now contain the changes we have made.

  • How Can We Add/remove Row's In "datatable" Object Of "dataset" ?

     “Datatable” provides “NewRow” method to add new row to “DataTable”. “DataTable” has “DataRowCollection” object which has all rows in a “DataTable” object.

    Following are the methods provided by “DataRowCollection” object :-

    Add: Adds a new row in DataTable Remove It removes a “DataRow” object from “DataTable” RemoveAt: It removes a “DataRow” object from “DataTable” depending on index position of the “DataTable”.

  • What Is Basic Use Of "dataview" ?

    “DataView” represents a complete table or can be small section of rows depending on some criteria. It is best used for sorting and finding data with in “datatable”.

    Dataview has the following method’s :-

    Find: It takes a array of values and returns the index of the row.

    FindRow: This also takes array of values but returns a collection of “DataRow”.

    If we want to manipulate data of “DataTable” object create “DataView” (Using the “DefaultView” we can create “DataView” object) of the “DataTable” object and use the following functionalities :-

    AddNew: Adds a new row to the “DataView” object. Delete Deletes the specified row from “DataView” object.

  • How Can We Add Relation's Between Table In A Dataset ?

    Dim objRelation As DataRelation objRelation=New 
    DataRelation ("CustomerAddresses", objDataSet. 
    Tables ("Customer"). Columns("Custid") ,objDataSet. 
    Tables("Addresses"). Columns ("Custid_fk")) 
    objDataSet.Relations. Add(objRelation)
    
     //Relations can be added between “DataTable” objects using 
    the “DataRelation” object. 
    
    //Above sample code is trying to build a relationship between “Customer” 
    and “Addresses” “Datatable” using “CustomerAddresses” “DataRelation” 
    object.
  • What Is The Use Of Commandbuilder ?

    CommandBuilder builds “Parameter” objects automatically.

    Below is a simple code which uses commandbuilder to load its parameter objects.

    Dim pobjCommandBuilder As New OleDbCommand Builder (pobj DataAdapter)
    
    pobjCommandBuilder.DeriveParameters(pobjCommand)

    Be careful while using “DeriveParameters” method as it needs an extra trip to the Datastore which can be very inefficient

  • What's Difference Between "optimistic" And "pessimistic" Locking ?

    In pessimistic locking when user wants to update data it locks the record and till then no one can update data. Other user’s can only view the data when there is pessimistic locking. In optimistic locking multiple users can open the same record for updating, thus increase maximum concurrency. Record is only locked when updating the record. This is the most preferred way of locking practically. Now a days browser based application is very common and having pessimistic locking is not a practical solution.

  • How Can We Perform Transactions In .net?

    The most common sequence of steps that would be performed while developing a transactional application is as follows:

    1. Open a database connection using the Open method of the connection object.
    2. Begin a transaction using the Begin Transaction method of the connection object.

    This method provides us with a transaction object that we will use later to commit or rollback the transaction.Note that changes caused by any queries executed before calling the Begin Transaction method will be committed to the database immediately after they execute. Set the Transaction property of the command object to the above mentioned transaction object. Execute the SQL commands using the command object. We may use one or more command objects for this purpose, as long as the Transaction property of all the objects is set to a valid transaction object. Commit or roll back the transaction using the Commit or Rollback method of the transaction object. Close the database connection.

  • What Is Difference Between Dataset Clone And Dataset Copy ?

    Dataset clone: - It only copies structure, does not copy data.

    Dataset copy: - Copies both structure and data.

  • How Can We Force The Connection Object To Close After My Data Reader Is Closed?

    Command method Execute reader takes a parameter called as Command Behavior where in we can specify saying close connection automatically after the Data reader is close.

    PobjDataReader = pobjCommand.ExecuteReader 
                    (CommandBehavior.CloseConnection)
  • I Want To Force The Data Reader To Return Only Schema Of The Data Store Rather Than Data?

    PobjDataReader = pobjCommand.ExecuteReader (CommandBehavior.SchemaOnly)
  • How Can We Fine-tune The Command Object When We Are Expecting A Single Row?

    Again, CommandBehaviour enumeration provides two values Single Result and Single Row. If you are expecting a single value then pass “CommandBehaviour.SingleResult” and the query is optimized accordingly, if you are expecting single row then pass “CommandBehaviour.SingleRow” and query is optimized according to single row.

  • Which Is The Best Place To Store Connection String In .net Projects?

    Config files are the best places to store connection strings. If it is a web-based application “Web.config” file will be used and if it is a windows application “App.config” files will be used.

  • How Can We Save All Data From Dataset?

    Dataset has “Accept Changes” method, which commits all the changes since last time “Accept changes” has been executed.

  • How Can We Add/remove Row Is In "data Table" Object Of "dataset"?

    “Data table” provides “NewRow” method to add new row to “Data Table”. “Data Table” has “DataRowCollection” object that has all rows in a “Data Table” object.

    Following are the methods provided by “DataRowCollection” object:-

    Add
    Adds a new row in Data Table.

    Remove
    It removes a “Data Row” object from “Data Table”.

    Remove At
    It removes a “Data Row” object from “Data Table” depending on index position of the “Data Table”.

  • What Is Basic Use Of "data View"?

    “Data View” represents a complete table or can be small section of rows depending on some criteria. It is best used for sorting and finding data with in “data table”.

    Data view has the following methods:-

    Find
    It takes an array of values and returns the index of the row.

    Find Row
    This also takes array of values but returns a collection of “Data Row”.

    If we want to manipulate data of “Data Table” object create “Data View” (Using the “Default View” we can create “Data View” object) of the “Data Table” object and use the following functionalities:-

    Add New
    Adds a new row to the “Data View” object.

    Delete
    Deletes the specified row from “Data View” object.

  • How Can We Load Multiple Tables In A Dataset?

    objCommand.CommandText = "Table1"
    objDataAdapter.Fill(objDataSet, "Table1")
    objCommand.CommandText = "Table2"
    objDataAdapter.Fill(objDataSet, "Table2")

    Above is a sample code, which shows how to load multiple “Data Table” objects in one “Dataset” object. Sample code shows two tables “Table1” and “Table2” in object ObjDataSet.

    lstdata.DataSource = objDataSet.Tables("Table1").DefaultView

    In order to refer “Table1” Data Table, use Tables collection of Datasets and the Default view object will give you the necessary output.

  • How Can We Add Relation Between Tables In A Dataset?

    Dim objRelation As DataRelation
    objRelation=New
    DataRelation("CustomerAddresses", objDataSet.Tables("Customer").Columns("Custid")
    ,objDataSet.Tables("Addresses").Columns("Custid_fk"))
    objDataSet.Relations.Add(objRelation)

    Relations can be added between “Data Table” objects using the “Data Relation” object.

    Above sample, code is trying to build a relationship between “Customer” and “Addresses” “Data table” using “Customer Addresses” “Data Relation” object.

  • What Is The Use Of Command Builder?

    Command Builder builds “Parameter” objects automatically. Below is a simple code, which uses command builder to load its parameter objects.

    Dim pobjCommandBuilder As New OleDbCommandBuilder(pobjDataAdapter)
    pobjCommandBuilder.DeriveParameters(pobjCommand)

    Be careful while using “Derive Parameters” method as it needs an extra trip to the Data store, which can be very inefficient

  • How Can We Perform Transactions In .net?

    The most common sequence of steps that would be performed while developing a transactional application is as follows:

    • Open a database connection using the Open method of the connection object.
    • Begin a transaction using the Begin Transaction method of the connection object.

    This method provides us with a transaction object that we will use later to commit or rollback the transaction. Note that changes caused by any queries executed before calling the Begin Transaction method will be committed to the database immediately after they execute. Set the Transaction property of the command object to the above mentioned transaction object.

    • Execute the SQL commands using the command object. We may use oneormorecommand objects for this purpose, as long as the Transaction property of all the objects is set to a valid transaction object.
    • Commit or roll back the transaction using the Commit or Rollback method of the transaction object.
    • Close the database connection.
  • Can You Explain The Difference Between An Ado.net Dataset And An Ado Record Set?

    There two main basic differences between record set and dataset:-

    • With dataset you an retrieve data from two databases like oracle and sql server and merge them in one dataset , with record set this is not possible.
    • All representation of Dataset is using XML while record set uses COM.
    • Record set cannot be transmitted on HTTP while Dataset can be.
  • What Is Maximum Pool Size In Ado.net Connection String?

    Maximum pool size decides the maximum number of connection objects to be pooled. If the maximum pool size is reached and there is no usable connection available the request is queued until connections are released back in to pool. So it’s always a good habit to call the close or dispose method of the connection as soon as you have finished work with the connection object.

  • How To Enable And Disable Connection Pooling?

    For .NET it is enabled by default but if you want to just make sure set Pooling=true in the connection string. To disable connection pooling set Pooling=false in connection string if it is an ADO.NET Connection.

    If it is an OLEDBConnection object set OLE DB Services=-4 in the connection string.

  • What Is The Namespace In Which .net Has The Data Functionality Class?

    Following are the namespaces provided by .NET for data management:-

    System. Data: 
    This contains the basic objects used for accessing and storing relational data, such as DataSet, DataTable, and Data Relation. Each of these is independent of the type of data source and the way we connect to it.

    System.Data.OleDB:
    It contains the objects that we use to connect to a data source via an OLE-DB provider, such as OleDbConnection, OleDbCommand, etc. These objects inherit from the common base classes, and so have the same properties, methods, and events as the SqlClient equivalents.

    System.Data.SqlClient:
    This contains the objects that we use to connect to a data source via the Tabular Data Stream (TDS) interface of Microsoft SQL Server (only). This can generally provide better performance as it removes some of the intermediate layers required by an OLE-DB connection.

    System.XML:
    This Contains the basic objects required to create, read, store, write, and manipulate XML documents according to W3C recommendations.

  • What Are Major Difference Between Classic Ado And Ado.net?

    Following are some major differences between both :-

    •  In ADO we have recordset and in ADO.NET we have dataset.
    • In recordset we can only have one table. If we want to accommodate more than one tables we need to do inner join and fill the recordset. Dataset can have multiple tables.
    • All data persist in XML as compared to classic ADO where data persisted in Binary format also.
  • What Is The Use Of Connection Object?

    They are used to connect a data to a Command object.

    • An OleDbConnection object is used with an OLE-DB provider
    • A SqlConnection object uses Tabular Data Services (TDS) with MS SQL Server.
  • How Can We Connect To Microsoft Access, Foxpro, And Oracle Etc?

    Microsoft provides System.Data.OleDb namespace to communicate with databases like success , Oracle etc. In short, any OLE DB-Compliant database can be connected using System.Data.OldDb namespace.

    Private Sub loadData()
    Dim strPath As String
    strPath = AppDomain.CurrentDomain.BaseDirectory
    Dim objOLEDBCon As New 
    OleDbConnection(“Provider=Microsoft.Jet.OLEDB.4.0;
    Data Source =” & strPath & “Nwind.mdb”)
    Dim objOLEDBCommand As OleDbCommand
    Dim objOLEDBReader As OleDbDataReader
    Try
    objOLEDBCommand = New OleDbCommand(“Select FirstName from Employees”)
    objOLEDBCon.Open()
    objOLEDBCommand.Connection = objOLEDBCon
    objOLEDBReader = objOLEDBCommand.ExecuteReader()
    Do While objOLEDBReader.Read()
    lstNorthwinds.Items.Add(objOLEDBReader.GetString(0))
    Loop
    Catch ex As Exception
    Throw ex
    Finally
    objOLEDBCon.Close()
    End Try
    End Sub

    The main heart is the “Load data ()” method which actually loads the data in list box.