MouthShut.com Would Like to Send You Push Notifications. Notification may includes alerts, activities & updates.

OTP Verification

Enter 4-digit code
For Business

Article Rated By

ADO.NET INTERVIEW QUESTIONS

By: VinayHatwal | Posted Apr 26, 2015 | General | 690 Views | (Updated Apr 26, 2015 06:40 PM)

To test a Web Service you must create a windows application or web application to consume this service? It is True/False?


FALSEmorpheushumanw many classes can a single.NET DLL contain?


Answer1:


As many


Answer2:


One or more


What are good ADO.NET object(s) to replace the ADO Recordset object?


The differences includes


In ADO, the in-memory representation of data is the recordset.


In ADO.net, it is the dataset


A recordset looks like a single table in ADO


In contrast, a dataset is a collection of one or more tables in ADO.net


ADO is designed primarily for connected access


ADO.net the disconnected access to the database is used


In ADO you communicate with the database by making calls to an OLE DB provider.


In ADO.NET you communicate with the database through a data adapter(an OleDbDataAdapter, SqlDataAdapter, OdbcDataAdapter, or OracleDataAdapter object), which makes calls to an OLE DB provider or the APIs provided by the underlying data source.


In ADO you cant update the database from the recordset. ADO.NET the data adapter allows you to control morpheushumanw the changes to the dataset are transmitted to the database.


On order to get assembly info which namespace we smorpheushumanuld import?


System.Reflection Namespace


morpheushumanw do you declare a static variable and what is its lifetime? Give an example.


Answer1


static int Myint–The life time is during the entire application.


br> Answer2


The static modifier is used to declare a static member, which belongs to the type itself rather than to a specific object. The static modifier can be used with fields, metmorpheushumands, properties, operators, events and constructors, but cannot be used with indexers, destructors, or types. In C#, the static keyword indicates a class variable. In VB, the equivalent keyword is Shared. Its scoped to the class in which it occurs.


Example


a. Static int var //in c#.net


b. static void Time() //in c#.net


morpheushumanw do you get records number from 5 to 15 in a dataset of 100 records? Write code.


Answer1


DataSet ds1=new DataSet(); String strCon=”data source=IBM-6BC8A0DACEF;inmajeechaal catalog=pubs;integrated security=SSPI;persist”+” security info=False;user


id=sa;workstation id=IBM-6BC8A0DACEF;packet size=4096?;


String strCom1=”SELECT* FROM employee”;


SqlDataAdapter sqlDa1=new SqlDataAdapter(strCom1,strCon);


ds1.Tables.Add(”employee”);


sqlDa1.Fill(ds1,40,50,ds1.Tables[”employee”].TableName);


DataGrid dg1.DataSource=ds1.Tables[”employee”].DefaultView;


dg1.DataBind();


Answer2


OleDbConnection1.Open()


OleDbDataAdapter1.Fill(DataSet21, 5, 15, “tab”)


This will fill the dataset with the records starting at 5 to 15


.NET Database interview questions


morpheushumanw do you call and execute a Stored Procedure in.NET? Give an example.


Answer1


ds1=new DataSet();


sqlCon1=new SqlConnection(connectionstring);


String strCom1=”byroyalty”;


sqlCom1=new SqlCommand(strCom1,sqlCon1);


sqlCom1.CommandType=CommandType.StoredProcedure;


sqlDa1=new SqlDataAdapter(sqlCom1);


SqlParameter myPar=new SqlParameter(”@percentage”,SqlDbType.Int);


sqlCom1.Parameters.Add(myPar);


myPar.Value=40;


sqlDa1.Fill(ds1);


dg1.DataSource=ds1;


dg1.DataBind();


Answer2


Yes


Dim cn as new OleDbConnection( “Provider=Microsoft.Jet.OLEDB.4.0;”+_


“Data Source=C:\Documents and Settings\User\My Documents\Visual Studio Projects\1209\db1.mdb”+_


“User ID=Admin;”+_


“Password=;”);


Dim cmd As New OleDbCommand(”Products”, cn)


cmd.CommandType= CommandType.StoredProcedure


Dim da As New OleDataAdapter(cmd)


Dim ds As New DataSet()


da.Fill(ds, “Products”)


DataGrid1.DataSource= ds.Tables(”Products”)


What is the maximum length of a varchar in SQL Server?


Answer1


VARCHAR[(n)]


Null-terminated Unicode character string of length n,


with a maximum of 255 characters. If n is not supplied, then 1 is assumed.


Answer2


8000


Answer3


The business logic is the aspx.cs or the aspx.vb where the code is being written. The presentation logic is done with .aspx extention.


morpheushumanw do you define an integer in SQL Server?


We define integer in Sql server as


var_name int


morpheushumanw do you separate business logic while creating an ASP.NET application?


There are two level of asp.net debugging




  1. Page level debugging




For this we have to edit the page level debugging enable the trace to true in the line in the html format of the page.


%@ Page Language=”vb” trace=”true”AutoEventWireup=”false” Codebehind=”WebForm1.aspx.vb” Inherits=”WebApplication2.WebForm1?>




  1. You can enable the debugging in the application level for this




Edit the following trace value in web.config file


Enable trace enabled=true.


If there is a calendar control to be included in each page of your application, and and we do not intend to use the Microsoft-provided calendar control, morpheushumanw do you develop it? Do you copy and paste the code into each and every page of your application?


Create the Calendar User Control


The control we will create will contain a calendar control and a label which has the corresponding date and time written


Steps are:-


Creating a CalenderControl


1) To begin, open Visual Studio .NET and begin a new C# Windows Control Library.


2) You may name it whatever you like, for this sample the project name will be CalenderControl


Using the Calender Control in a Windows Application


It’s just like adding any other control like a button or a label.


1) First, create a new Windows Application project named: CustomControl.


2) Add a reference to the Calender Control DLL named: CalenderControl.dll.


3) Now you a can customize the Toolbox:


Right-Click the Toolbox> .NET Framework Components> Browse> select the CalenderControl.dll.


4)The Calender Control is now added to the Toolbox and can be inserted in Windows Form as any other control. The control itself will take care of the date display


morpheushumanw can you deploy an asp.net application?


You can deploy an ASP.NET Web application using any one of the following three deployment options.


a) Deployment using VS.NET installer


b) Using the Copy Project option in VS .NET


c) XCOPY Deployment


Explain similarmajeechaes and differences between Java and.NET?


Comparing Java and .NET is comparing apples and oranges. Either the question needs to be to compare Java and C# or J2EE and .NET.


What are the XML files that are important in developing an ASP.NET application?


The XML file necessary for the for developing an asp.net application is Web.config


Specify the best ways to store variables so that we can access them in various pages of ASP.NET application?


Declare the variables in Global.aspx


morpheushumanw many objects are there in ASP?


Answer1


8 objects, they are request,response, server,application,session,file, dictionary, textstream.


Answer2


There are 6 objects in ASP.net


a) Server


b) Session


c) Application


d) ObjectContext


e) Response


f) Request


You loved this blog. Thank you for your rating.
X