Monday, 29 April 2013

How to Install SharePoint 2010 in Windows 7

In my previous articles i explained Asp.NET, C#.NET, jQuery. In this article i was explaining how to install SharePoint 2010 on Windows 7 OS.

Please follow the below steps carefully.

Installing SharePoint Foundation on Windows 7 64 bit
Please install Visual Studio 2010 first (Software location will be provided)
For installing SharePoint Foundation (Software location will be provided), please follow the steps mentioned in this document in that order.
Copy the SharePointFoundation.exe installation file to c:\SharePointFiles (This is important)
Extract the installation files by opening a Command Prompt window, and then typing the following command at the directory location of the folder where you copied the installation files in the previous step. Please follow the below screen shot:
Open command prompt and go to c:\SharePointFiles as shown below


Then type  SharePointFoundation /extract:c:\SharePointFiles\ as shown in screen shot below

Then the files will be extracted to C:\SharePoint files as shown below

Using a text editor such as Notepad, open the installation configuration file, config.xml, located in the following path: c:\SharePointFiles\files\Setup\config.xml
Add the following setting as it is under configuration tab: (This is case sensitive)
      <Setting Id="AllowWindowsClientInstall" Value="True"/>
Save and close the config.xml
Then open the command prompt and install Microsoft FilterPack 2.0 by typing
c:\SharePointFiles\PrerequisiteInstallerFiles\FilterPack\FilterPack.msi (screen shot below)

Next step is to copy paste the below text(as it is) at the command prompt as show in the screen show below:
start /w pkgmgr /iu:IIS-WebServerRole;IIS-WebServer;IIS-CommonHttpFeatures;^
IIS-StaticContent;IIS-DefaultDocument;IIS-DirectoryBrowsing;IIS-HttpErrors;^
IIS-ApplicationDevelopment;IIS-ASPNET;IIS-NetFxExtensibility;^
IIS-ISAPIExtensions;IIS-ISAPIFilter;IIS-HealthAndDiagnostics;^
IIS-HttpLogging;IIS-LoggingLibraries;IIS-RequestMonitor;IIS-HttpTracing;IIS-CustomLogging;IIS-ManagementScriptingTools;^
IIS-Security;IIS-BasicAuthentication;IIS-WindowsAuthentication;IIS-DigestAuthentication;^
IIS-RequestFiltering;IIS-Performance;IIS-HttpCompressionStatic;IIS-HttpCompressionDynamic;^
IIS-WebServerManagementTools;IIS-ManagementConsole;IIS-IIS6ManagementCompatibility;^
IIS-Metabase;IIS-WMICompatibility;WAS-WindowsActivationService;WAS-ProcessModel;^
WAS-NetFxEnvironment;WAS-ConfigurationAPI;WCF-HTTP-Activation;^
WCF-NonHTTP-Activation
It takes a while to enable the features. After the process is done please open the control panel to make sure all the features are enabled: Please follow below steps:
1.       Open Control Panel
2.       Click on Programs
3.       Click on Turn Windows Features on or Off
4.       Make sure the features below in the next two screen shots are enabled


After checking that the features are enabled, Please RESTART your machine.
After restarting the machine, to install SharePoint Server 2010 or SharePoint Foundation 2010, open a Command Prompt window, and then type the following at the command prompt:




Click on STANDALONE


After installation, Please close the wizard after unchecking the checkboxRun the SharePoint Products Configuration wizard
      
Next step is to install Windows Identity Foundation. Download link will be provided.( File name will be Windows6.1-KB974405-x64.msu)
After installing Windows Identity Foundation,Please install the hotfix for SQL Server 2008. File name will be SQLServer2008-KB970315-x64.exe . Download location will be provided. (Screen shots below).









Click close and then Run the SharePoint 2010 Product Configuration Wizard.(Screen shot below)
(Start->All Programs ->Microsoft SharePoint 2010 Products ->SharePoint 2010 Product Configuration Wizard)

You should be able to open the Central Administration.
(Start->All Programs ->Microsoft SharePoint 2010 Products ->SharePoint 2010 Central Administration)

Thursday, 18 April 2013

How to upload PDF document in ASP.NET application


In Previous Articles i explained how to upload image into Database. In this article i explained How to upload pdf document with in asp.net application

Default.aspx


<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebTestSharp._Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Web Barcode Reader Tester (C#)</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        Click browse button to upload a PDF document<br />
        <asp:FileUpload ID="FileUpload1" runat="server" /><br />
        <br />
        <asp:Button id="UploadButton" 
           Text="Upload file"
           OnClick="UploadButton_Click"
           runat="server">
       </asp:Button> 
        <br />
       <br />
        <asp:Label id="UploadStatusLabel" Text="" runat="server"></asp:Label> 
        <br />
        <asp:ListBox ID="ListBox1" runat="server" Visible="False"></asp:ListBox><br />
        <br />
        </div>
    </form>
</body>
</html>

===================================================================
VB.NET Code


Imports System.Drawing

Imports Bytescout.BarCodeReader


Public Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub UploadButton_Click(sender As Object, e As EventArgs)
Dim savePath As [String] = "\uploads\"

If FileUpload1.HasFile Then
Dim fileName As [String] = FileUpload1.FileName
savePath += fileName
FileUpload1.SaveAs(Server.MapPath(savePath))

            Dim barcodeReader As New Reader()

            ' reader.MediumTrustLevelCompatible = true ' uncomment this line to enable Medium Trust compatible mode (slows down the recognition process as direct image data access is disabled in Medium Trust mode)


            UploadStatusLabel.Visible = False
            ListBox1.Items.Clear()
            ListBox1.Visible = True

            ListBox1.Items.Add("Reading barcode(s) from PDF")

            Dim barcodes As FoundBarcode() = barcodeReader.ReadFrom(Server.MapPath(savePath))

            If barcodes.Length = 0 Then
                ListBox1.Items.Add("    No barcodes found")
            Else
                For Each barcode As FoundBarcode In barcodes
                    ListBox1.Items.Add([String].Format("    Found barcode with type '{0}' and value '{1}'", barcode.Type, barcode.Value))
                Next
            End If


        Else
            ' Notify the user that a file was not uploaded.
            UploadStatusLabel.Text = "You did not specify a file to upload."
        End If
End Sub
End Class
===================================================================
C#.NET Code



using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Drawing.Imaging;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Drawing;
using System.Collections.Generic;

using Bytescout.BarCodeReader;

namespace WebTestSharp
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void UploadButton_Click(object sender, EventArgs e)
        {
            String savePath = @"\uploads\";

            if (FileUpload1.HasFile)
            {
                String fileName = FileUpload1.FileName;
                savePath += fileName;
                FileUpload1.SaveAs(Server.MapPath(savePath));

Reader barcodeReader = new Reader();

            // reader.MediumTrustLevelCompatible = true; // uncomment this line to enable Medium Trust compatible mode (slows down the recognition process as direct image data access is disabled in Medium Trust mode)
UploadStatusLabel.Visible = false;

                    ListBox1.Items.Clear();
                    ListBox1.Visible = true;
ListBox1.Items.Add("Reading barcode(s) from image #" + imgNum);

FoundBarcode[] barcodes = barcodeReader.ReadFrom(savePath);

if (barcodes.Length == 0)
{
ListBox1.Items.Add("    No barcodes found");
}
else
{
foreach (FoundBarcode barcode in barcodes)
ListBox1.Items.Add(String.Format("Found barcode with type '{0}' and value '{1}'", barcode.Type, barcode.Value));
}

            }
            else
            {
                // Notify the user that a file was not uploaded.
                UploadStatusLabel.Text = "You did not specify a file to upload.";
            }
        }
    }
}

=====================================================================


How to Install SQL Server 2008 R2



The SQL Server Installation Wizard provides a single feature tree for installation of all SQL Server components so that you do not have to install the following components individually:
  • Database Engine
  • Analysis Services
  • Reporting Services
  • Integration Services
  • Replication
  • Management tools
  • Connectivity components
  • Sample databases, samples, and SQL Server Books Online
    Prerequisites

    To install SQL Server 2008 R2

    1. Insert the SQL Server installation media. From the root folder, double-click Setup.exe. To install from a network share, locate the root folder on the share, and then double-click Setup.exe. If the Microsoft SQL Server 2008 Setup dialog box appears, click OK to install the prerequisites, then click Cancel to exit SQL Server installation.
    2. If the .NET Framework 3.5 SP1 installation dialog box appears, select the check box to accept the .NET Framework 3.5 SP1 License Agreement. Click Next. To exit SQL Server installation, click Cancel. When installation of .NET Framework 3.5 SP1 is complete, click Finish.
    3. Windows Installer 4.5 is also required, and might be installed by the Installation Wizard. If you are prompted to restart your computer, restart it, and then restart SQL Server Setup.exe.
    4. When the prerequisites are installed, the Installation Wizard runs the SQL Server Installation Center. To create a new installation of SQL Server, click New Installation or Add Features to an Existing Installation.
    5. The System Configuration Checker runs a discovery operation on your computer. To continue, click OK. If Setup detects SQL Server 2008 on the machine, you will see a warning about the automatic upgrade of shared components to SQL Server 2008 R2. For more information about side-by-side instances of SQL Server 2008 R2 and SQL Server 2008, see Considerations for Side-by-Side Instances of SQL Server 2008 R2 and SQL Server 2008. Setup log files are created for your installation. For more information, see How to: View and Read SQL Server Setup Log Files.
    6. On the Language Selection page, you can specify the language for your instance of SQL Server if you are installing on a localized operating system and the installation media includes language packs for both English and the language corresponding to the operating system. For more information about cross-language support and installation considerations, see Local Language Versions in SQL Server.
      To continue, click Next.
    7. On the Product Key page, select an option button to indicate whether you are installing a free edition of SQL Server, or a production version of the product that has a PID key. For more information, see Editions and Components of SQL Server 2008 R2.
    8. On the License Terms page, read the license agreement, and then select the check box to accept the license terms and conditions. To help improve SQL Server, you can also enable the feature usage option and send reports to Microsoft.
    9. The System Configuration Checker verifies the system state of your computer before Setup continues.
    10. On the Feature Role page, select SQL Server Feature Installation, and then click Next to continue to the Feature Selection page.
    11. On the Feature Selection page, select the components for your installation. A description for each component group appears in the right pane after you select the feature name. You can select any combination of check boxes. For more information, see Editions and Components of SQL Server 2008 R2.
      You can also specify a custom directory for shared components by using the field at the bottom of the Feature Selection page. To change the installation path for shared components, either update the path in the field at the bottom of the dialog box, or click Browse to move to an installation directory. The default installation path is C:\Program Files\Microsoft SQL Server\100\.
    12. On the Instance Configuration page, specify whether to install a default instance or a named instance. For more information, see Instance Configuration. Click Next to continue.
      Instance ID — By default, the instance name is used as the Instance ID. This is used to identify installation directories and registry keys for your instance of SQL Server. This is the case for default instances and named instances. For a default instance, the instance name and instance ID would be MSSQLSERVER. To use a nondefault instance ID, select the Instance ID check box and provide a value.
      NoteNote
      Typical stand-alone instances of SQL Server 2008 R2, whether default or named instances, do not use a nondefault value for the Instance ID check box.
      Instance root directory — By default, the instance root directory is C:\Program Files\Microsoft SQL Server\100\. To specify a nondefault root directory, use the field provided, or click Browse to locate an installation folder.
      All SQL Server service packs and upgrades will apply to every component of an instance of SQL Server.
      Detected instances and features — The grid shows instances of SQL Server that are on the computer where Setup is running. If a default instance is already installed on the computer, you must install a named instance of SQL Server 2008 R2.
    13. The Disk Space Requirements page calculates the required disk space for the features that you specify. Then it compares the required space to the available disk space. For more information, see Disk Space Requirements.
    14. Work flow for the rest of this topic depends on the features that you have specified for your installation. You might not see all the pages, depending on your selections.
    15. On the Server Configuration — Service Accounts page, specify login accounts for SQL Server services. The actual services that are configured on this page depend on the features that you selected to install.
      You can assign the same login account to all SQL Server services, or you can configure each service account individually. You can also specify whether services start automatically, are started manually, or are disabled. Microsoft recommends that you configure service accounts individually to provide least privileges for each service, where SQL Server services are granted the minimum permissions they have to have to complete their tasks. For more information, see Server Configuration - Service Accounts and Setting Up Windows Service Accounts.
      To specify the same logon account for all service accounts in this instance of SQL Server, provide credentials in the fields at the bottom of the page.
      Security Note   Do not use a blank password. Use a strong password.
      When you are finished specifying login information for SQL Server services, click Next.
    16. Use the Server Configuration — Collation tab to specify nondefault collations for the Database Engine and Analysis Services. For more information, see Server Configuration - Collation.
    17. Use the Database Engine Configuration - Account Provisioning page to specify the following:
      • Security Mode — select Windows Authentication or Mixed Mode Authentication for your instance of SQL Server. If you select Mixed Mode Authentication, you must provide a strong password for the built-in SQL Server system administrator account.
        After a device establishes a successful connection to SQL Server, the security mechanism is the same for both Windows Authentication and Mixed Mode. For more information, see Database Engine Configuration - Account Provisioning.
      • SQL Server Administrators — You must specify at least one system administrator for the instance of SQL Server. To add the account under which SQL Server Setup is running, click Add Current User. To add or remove accounts from the list of system administrators, click Add or Remove, and then edit the list of users, groups, or computers that will have administrator privileges for the instance of SQL Server. For more information, see Database Engine Configuration - Account Provisioning.
      When you are finished editing the list, click OK. Verify the list of administrators in the configuration dialog box. When the list is complete, click Next.
    18. Use the Database Engine Configuration - Data Directories page to specify nondefault installation directories. To install to default directories, click Next.
      Important noteImportant
      If you specify nondefault installation directories, ensure that the installation folders are unique to this instance of SQL Server. None of the directories in this dialog box should be shared with directories from other instances of SQL Server.
      For more information, see Database Engine Configuration - Data Directories.
    19. Use the Database Engine Configuration - FILESTREAM page to enable FILESTREAM for your instance of SQL Server. For more information, see Database Engine Configuration - Filestream.
    20. Use the Analysis Services Configuration — Account Provisioning page to specify users or accounts that will have administrator permissions for Analysis Services. You must specify at least one system administrator for Analysis Services. To add the account under which SQL Server Setup is running, click Add Current User. To add or remove accounts from the list of system administrators, click Add or Remove, and then edit the list of users, groups, or computers that will have administrator privileges for Analysis Services. For more information, see Analysis Services Configuration - Account Provisioning.
      When you are finished editing the list, click OK. Verify the list of administrators in the configuration dialog box. When the list is complete, click Next.
    21. Use the Analysis Services Configuration — Data Directories page to specify nondefault installation directories. To install to default directories, click Next.
      Important noteImportant
      If you specify nondefault installation directories, ensure that the installation folders are unique to this instance of SQL Server. None of the directories in this dialog box should be shared with directories from other instances of SQL Server.
      For more information, see Analysis Services Configuration - Data Directories.
    22. Use the Reporting Services Configuration page to specify the kind of Reporting Services installation to create. Options include the following:
      • Native mode default configuration
      • SharePoint mode default configuration
      • Unconfigured Reporting Services installation
      For more information about Reporting Services configuration modes, see Report Server Installation Options.
    23. On the Error Reporting page, specify the information that you want to send to Microsoft to help improve SQL Server. By default, option for error reporting is enabled. For more information, see Error Reporting.
    24. The System Configuration Checker will run one more set of rules to validate your computer configuration with the SQL Server features that you have specified.
    25. The Ready to Install page shows a tree view of installation options that were specified during Setup. To continue, click Install.
    26. During installation, the Installation Progress page provides status so that you can monitor installation progress as Setup continues.
    27. After installation, the Complete page provides a link to the summary log file for the installation and other important notes. To complete the SQL Server installation process, click Close.
    28. If you are instructed to restart the computer, do so now. It is important to read the message from the Installation Wizard when you have finished with Setup. 

Friday, 5 April 2013

Hosting ASP.Net application on the web server (IIS)



In this article, I am going to show how to host an asp.net application on IIS 7 (I have shown this example on Windows 7 Home Premium OS), however similar steps can be followed to host the application on the Windows Server 2008 R2 as well.

Introduction

In general hosting part of the application is not done by developer however in some scenario where the team size is small or we need to host the application on the local server, we developer does all the work. In this article, I am going to show how to host an asp.net application on IIS 7.5 in Windows 7 Home Premium Operating System.

Step 1

Open the IIS either from the Start Menu by writing the "inetmgr" command in the search box or at the command window (you must have the administrative priviledge).


You can also achieve the same by going to Control Panel and clicking on Administrative Tools > Internet Information Services (IIS) Manager as displayed in the picture below.



If you are not able to see the Internet Information Service (IIS) Manager, your computer might not have IIS installed. To install the IIS, follow below steps.

Installing IIS on Windows 7

Go to Control Panel > Programs > Turn Windows Features on or off as displayed in the picture below.



Ensure that from the Tree View, the Checkboxes against the Internet Information Services (IIS) is checked, even explore the depth of this root folder and check almost all checkboxes as displayed in the picture below. Checking almost all checkboxes will install more than enough (extra components as well that is not required for web hosting) component to get started and you may not use all the components. However later on you can uncheck to un-install those.



I have written hundreds of .NET How to's solution (ebook + source code + video) series based on real time project problems, click here to get it.
Step 2
Once you have opened the Internet Information Service (IIS) Manager, your screen should look like below (displayed the left panel in the below picture).


Now, right click the Sites and select Add Web Site ... and your screen should look like below



Enter the Site Name (in my case its SampleWebSite), select the physical folder where you have kept your website files (this may be your Visual Studio solution folder if you are setting it up at your local machine or the unpackaged folder path or the root folder of the website or web application). Now you can click on the OK button.



Clicking OK button may give you above alert box, complaining about the port you are going to use as by default port 80 is used for the default website of your IIS so you might want to change it. Click on No button at above alert box and change the port. I have changed the port to 8123 as displayed below and clicked on OK button.



Clicking OK should give you a screen something similar to below picture where you will have a SampleWebSite created (notice at the left panel).



Step 3


Now, you may click on the Advance Settings ... from the right panel and modify some settings that you want to modify. In general it is not needed and you can keep it default.



Step 4


Now, your website is ready to be browsed, you can right click on the website name (SampleWebSite in my case) and go to Manage Web Site > Browse and you should have an Internet Explorer window open displaying the default page of your website or web application.



Below is the screenshot of the default page of my SampleWebSite.



Step 5 (Optional)


Notice: Your website may not work if you have developed your it Visual Studio 2010 as your web.config file may have some tags that is not identified by the IIS. This is becuase creating the website the way we created just now will host your website in its own application pool that will have .NET Framework version 2 as target version. So you will need to change to the .NET Framework 4.0 version.



Click on Application Pools from the left panel and double click the Application pool for your webiste (generally application pool for your website is your website name so in my case SampleWebSite) and you should see a dialogue box similar to above. Select .NET Framework v4.xxx from the .NET Framework version dropdown and click OK. Now follow the Step 4 above again and your should see the default page.


Conclusion


Hope these 5 steps of hosting an application to the IIS will be helpful. Thanks for reading and keep sharing your knowledge. Pleaase me know your comment or feedback.

Wednesday, 3 April 2013

ADO.NET Interview Questions


ADO.Net Interview Question and Answers

1.What is Ado.NET?
  •   ADO.NET is an object-oriented set of libraries that allows you to interact with data sources.
  •   ADO.NET is a set of classes that expose data access services to the .NET programmer.
  •   ADO.NET is also a part of the .NET Framework.
  •   ADO.NET is used to handle data access.

2.What are the two fundamental objects in ADO.NET?

There are two fundamental objects in ADO.NET.

  • Datareader - connected architecture and
  • Dataset - disconnected architecture.


3.What are the data access namespaces in .NET?

The most common data access namespaces :
  •   System.Data
  •   System.Data.OleDb
  •   System.Data.SQLClient
  •   System.Data.SQLTypes
  •   System.Data.XML

4.What are major difference between classic ADO and ADO.NET?

  • In ADO the in-memory representation of data is the recordset. A Recordset object is used to hold a set of records from a database table.
  • In ADO.NET we have dataset.A DataSet is an in memory representation of data loaded from any data source.


5. What is the use of Connection object in Ado.Net?

The ADO Connection Object is used to create an open connection to a data source. Through this connection, you can access and manipulate a database.

6.What are the benefits of ADO.NET?
  •   Scalability
  •   Data Source Independence
  •   Interoperability
  •   Strongly Typed Fields
  •   Performance

7.What is a Clustered Index?


  • The data rows are stored in order based on the clustered index key. Data stored is in a sequence of the index. 
  • In a clustered index, the physical order of the rows in the table is the same as the logical (indexed) order of the key values. 
  • A table can contain only one clustered index. A clustered index usually provides faster access to data than does a non-clustered index.


8.What is a Non-Clustered Index?


  • The data rows are not stored in any particular order, and there is no particular order to the sequence of the data pages. 
  • In a clustered index, the physical order of the rows in the table is not same as the logical (indexed) order of the key values.


9.Whate are different types of Commands available with DataAdapter ?

The SqlDataAdapter has
  •   SelectCommand
  •   InsertCommand
  •   DeleteCommand
  •   UpdateCommand


10.What is the difference between an ADO.NET Dataset and an ADO Recordset?

  •   Dataset can fetch source data from many tables at a time, for Recordset you can achieve the same only using theSQL joins.
  •   A DataSet can represent an entire relational database in memory, complete with tables, relations, and views, ARecordset can not.
  •  A DataSet is designed to work without any continues connection to the original data source; Recordset maintains continues connection with the original data source.
  •   DataSets have no current record pointer, you can use For Each loops to move through the data. Recordsets have pointers to move through them.

11.Which method do you invoke on the DataAdapter control to load your generated dataset with data?

DataAdapter’ fill ( ) method is used to fill load the data in dataset.

12.What are the different methods available under sqlcommand class to access the data?
  •   ExecuteReader - Used where one or more records are returned - SELECT Query.
  •   ExecuteNonQuery - Used where it affects a state of the table and no data is being queried - INSERT, UPDATE,DELETE, CREATE and SET queries.
  •   ExecuteScalar - Used where it returns a single record.
 
13.What is a DataSet?

A DataSet is an in memory representation of data loaded from any data source.

14.What is a DataTable?

A DataTable is a class in .NET Framework and in simple words a DataTable object represents a table from a database.

15.What is the data provider name to connect to Access database?

Microsoft.Access

16.Which namespaces are used for data access?
  •   System.Data
  •   System.Data.OleDB
  •   System.Data.SQLClient

17.What is difference between Dataset. clone and Dataset.copy?


  • Clone: - It only copies structure, does not copy data.
  • Copy: - Copies both structure and data.


18.What is difference 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.

19.What is DataAdapter?

A data adapter represents a set of methods used to perform a two-way data updating mechanism between a disconnected DataTable and the database. It aggregates four commands: select, update, insert and delete command. One adapter can only generate and fill one table in a DataSet.

20.What is a Command Object?

The ADO Command object is used to execute a single query against a database. The query can perform actions like creating, adding, retrieving, deleting or updating records.

21.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”.

22.What is the use of Connection Object?

The ADO Connection Object is used to create an open connection to a data source. Through this connection, you can access and manipulate a database.

23.What are the advantage of ADO.Net?

§  Database Interactions Are Performed Using Data Commands
§  Data Can Be Cached in Datasets
§  Datasets Are Independent of Data Sources
§  Data Is Persisted as XML.

24.What is a stored procedure?

A stored procedure is a precompiled executable object that contains one or more SQL statements.
A stored procedure may be written to accept inputs and return output

25.What is the difference between OLEDB Provider and SqlClient ?

SQLClient .NET classes are highly optimized for the .net / sqlserver combination and achieve optimal results. The SqlClient data provider is fast. It's faster than the Oracle provider, and faster than accessing database via the OleDblayer.

26.What is the use of Parameter Object?

In ADO Parameter object provides information about a single parameter used in a stored procedure or query.

27.What is DataAdapter?

DataSet contains the data from the DataAdapter which is the bridge between the DataSet and Database.

DataAdapter provides the way to retrieve and save data between the DataSet and Database. It accomplishes this by means of request to the SQL Commands made against the database.

28.What does ADO mean?

ADO stands for ActiceX Data Objects.It was introduced few years ago as a solution to accessing data that can be found in various forms, not only over a LAN but over the internet. It replaced the data access technologies RDO

(Remote Data Objects) and DAO (Data Access Objects).

29.Name some ADO.NET Objects?
  •  Connection Object
  •  DataReader Object
  •  Command Object
  •  DataSet Object
  •  DataAdapter Object
30.What is Data Provider?

A set of libraries that is used to communicate with data source. Eg: SQL data provider for SQL, Oracle data provider for Oracle, OLE DB data provider for access, excel or mysql.

31.What is the DataTableCollection?

An ADO.NET DataSet contains a collection of zero or more tables represented by DataTable objects. The DataTableCollection contains all the DataTable objects in a DataSet.

32.What are the benefits of ADO.NET?

ADO.NET offers several advantages over previous versions of ADO and over other data access components. These benefits fall into the following categories:

  •         Interoperability
  •         Maintainability
  •         Programmability
  •         Performance
  • Scalability


33.How to creating a SqlConnection Object?

SqlConnection conn = new SqlConnection("Data Source=DatabaseServer;Initial Catalog=Northwind;User ID=YourUserID;Password=YourPassword");

34.How to creating a SqlCommand Object?

It takes a string parameter that holds the command you want to execute and a reference to a SqlConnection object.
SqlCommand cmd = new SqlCommand("select CategoryName from Categories", conn);

35.How to load multiple tables into dataset?

SqlDataAdapter da = new SqlDataAdapter("Select * from Id; Select * from Salry", mycon);
da.Fill(ds);
ds.Tables[0].TableName = "Id";
ds.Tables[1].TableName = "Salary";

36.What is the provider and namespaces being used to access oracle database?

System.Data.Oledb

37.What is the difference between SqlCommand and SqlCommandBuilder?

SQLCommand is used to retrieve or update the data from database.
SQLCommandBuilder object is used to build & execute SQL (DML) queries like select insert update& delete.

38.What is the use of SqlCommandBuilder?

SQL CommandBuilder object is used to build & execute SQL (DML) queries like select insert update& delete.

39.What are managed providers?

A managed provider is analogous to ODBC driver or OLEDB provider. It performs operation of communicating with

the database. ADO.NET currently provides two distinct managed providers. The SQL Server managed provider is

used with SQL server and is a very efficient way of communicating with SQL Server. OLEDB managed provider is

used to communicate with any OLEDB compliant database like Access or Oracle.

40.How do I delete a row from a DataTable?

ds.Tables("data_table_name").Rows(i).Delete
dscmd.update(ds,"data_table_name")

41.What inside in DataSet?

Inside DataSet much like in Database, there are tables, columns, constraints, relationships, views and so forth.

42.Explain ADO.Net Architecture?

ADO.NET provides the efficient way to manipulate the database. It contains the following major components. 1.

DataSet Object 2. Data Providers :
·         Connection Object
·         Command Object
·         DataReader Object
·         DataAdapter Object.

43.What is the difference between int and int32?

Both are same. System.Int32 is a .NET class. Int is an alias name for System.Int32.

44.What is the role of the DataReader class in ADO.NET connections?

It returns a read-only, forward-only rowset from the data source. A DataReader provides fast access when a

forward-only sequential read is needed.

45.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. OLE-DB.NET is

a .NET layer on top of the OLE layer, so it’s not as fastest and efficient as SqlServer.NET.

46.What are acid properties?

Ø  Atomicity
Ø  Consistency
Ø  Isolation
Ø  Durability

47.What is DataRowCollection?

Similar to DataTableCollection, to represent each row in each Table we have DataRowCollection.

48.What is the use of Ado.net connection?

Establishes a connection to a specific data source.

49.What are basic methods of Dataadapter?

§  Fill
§  FillSchema
§  Update

50.What are the various methods provided by the dataset object to generate XML?

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.

51.What is DataSet Object?

Dataset is a disconnected, in-memory representation of data. It can contain multiple data table from different

database.

52.What is 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.

53.What is Execute Non Query?

The ExecuteNonQuery() is one of the most frequently used method in SqlCommand Object, and is used for executing

statements that do not return result sets (ie. statements like insert data , update data etc.).

54.What providers does Ado.net uses?

The .NET Framework provides mainly three data providers, they are Microsoft SQL Server, OLEDB, ODBC.