Sunday, November 23, 2008

Architecture of connected environment of data access in ADO.Net?
The connected environment of data access is the common procedure for accessing data programmatically. The differentiating property of the connected data access environment is that here you (the programmer) is required to manage the connection with the database. You can only perform database operations when, there exists an open connection to the database. Hence, before performing any database operation (select, update, insert, delete). The important objects for working in the connected environment are:

  1. Connection (SqlConnection, OleDbConnection, etc): It represents a connection to the database. All the connection objects in the ADO.Net implement the System.Data.IDbConnection interface.
  2. Command (SqlCommand, OleDbCommand, etc): It represents the SQL command sent to the database, e.g., SELECT, UPDATE, INSERT, DELETE. All commands in ADO.Net implements IDbCommand interface.
  3. DataReader (SqlDataReader, OleDbDataReader, etc): It represents a data stream .

What is function of data adapter?
A data adapter is integral to the working of ADO.NET since data is transferred to and from a database through a data adapter. A data adapter creates a dataset and updates the database. When you make any changes to the dataset, the modifications to the database are actually performed by the data adapter.

Find all tables in database.
SQL SERVER 2000: select name from sysobjects where type='U'
SQL SERVER 2005: select name from sys.tables
In SQL Server 2005, you can find whether a table is replicated. Execute the following query.
select * from sys.tables where is_replicated =1

Find all views in database
SQL SERVER 2000: select name from sysobjects where type='V'
SQL SERVER 2005: select name from sys.views
In SQL Server 2005, you can find whether a view is replicated. Execute the following query.
select * from sys.views where is_replicated =1

Find all triggers in database
SQL SERVER 2000: select name from sysobjects where type='TR'
SQL SERVER 2005: select name from sys.triggers where parent_class=1
In SQL Server 2005, the triggers can be Assembly trigger (CLR) or a SQL trigger. In addition, we can find whether the trigger is an AFTER trigger or INSTEAD of trigger.
Select name from sys.triggers where type='TA'
Select name from sys.triggers where type='TR'
Select name from sys.triggers where is_instead_of_trigger=1

Find all Sql logins in a server
SQL SERVER 2000: select * from master.syslogins where isntgroup=0 and isntname=0
SQL SERVER 2005: select * from sys.sql_logins

Find all dependencies of the SQL Object in a database
SQL SERVER 2000: Select * from sysdepends
SQL SERVER 2005: Select * from sys.sql_dependencies

Find all data types in SQL Server
SQL SERVER 2000: Select * from systypes
SQL SERVER 2005: Select * from sys.systypes

Find all error messages in SQL Server
SQL SERVER 2000: select * from master.sysmessages
SQL SERVER 2005: select * from sys.messages

Find all the database files of the current database.
SQL SERVER 2000: Select name,filename from sysfiles
SQL SERVER 2005: Select name, physical_name from sys.database_files

Find the type of index.
SQL SERVER 2000: We have to use id column to determine the type of index from 0,1 or 255.
SQL SERVER 2005: select object_name(object_id),name, type_desc from sys.indexes where type_desc ='CLUSTERED'
Select object_name(object_id),name, type_desc from sys.indexes where type_desc ='HEAP'
Select object_name(object_id),name, type_desc from sys.indexes where type_desc ='NONCLUSTERED'
Select object_name(object_id),name, type_desc from sys.indexes where type_desc ='XML'

What is .Net Assembly?

An assembly is a single deployable unit that contains all the information about the implementation of classes, structures, and interfaces. An assembly stores all the information about itself. This information is called metadata, and it includes the name and version number of the assembly, security information, information about the dependencies, and a list of the files that constitute an assembly.

Difference between Simple binding and complex binding?

Simple data binding is the process of binding a control, such as a TextBox or a Label control, to a value in a dataset. The dataset value can be bound to the control by using the properties of the control. A Textbox control is used for simple binding. While simple data binding involves binding a control to a dataset value, complex data binding is the process of binding a component to display multiple values for a column from the dataset rows. The DataGrid, Listbox, and ComboBox controls are used for complex binding.

What is Runtime Host?

.NET framework supports different type of applications like Web, windows, console etc. Each type of application needs a runtime host to start it. This runtime host loads the runtime into a process, creates the application with in the process and loads the application code into the process. Runtime hosts included in .NET framework are:

  1. ASP.NET.
  2. Microsoft Internet Explorer.
  3. Shell executables. 1)It loads the runtime that can handle a web request into the process. ASP.NET also creates an application domain for each Web application that will run on a Web server. 2)It creates an application domain to run managed controls. 3)When ever a runtime executable is launched from the shell, this executable invokes the corresponding runtime host.

What is .Net Remoting ?

Operating systems and run-time environments provide application isolation to ensure that the code in one application does not adversely affect another application. Isolating applications helps ensure that an application does not access the address space of another application. In the .NET Framework, the CLR uses application domains to isolate applications. Thus, an application domain is a secure unit of processing in the .NET Framework.Microsoft .NET Remoting provides a framework to allow objects to interact with other objects residing in different application domains, different processes, and on different computers. .NET remoting provides services, such as channels, formatters, object activation and life cycle, and object registration to achieve interaction between remote objects. Channels are used as transport mediums when a client invokes a method of a remote object.A remote object may provide more than one channel. The client can select the channel that best suits its requirement.Formatters are used to encode and decode messages before the channel transports the messages.

What are the Various componenets in .Net framework?

The .NET Framework consists of Web Forms, Windows Forms, and Console applications that pertain to the presentation layer of an application. Besides these three components, the .NET Framework consists of two other components, the .NET Framework Base Classes and the Common Language Runtime (CLR).

What is Common language runtime?
The Common Language Runtime is the execution engine for .NET Framework applications. It performs a number of functions, such as loading and executing an application, performing automatic memory management, ensuring type safety, and handling exceptions. It is one of the most important components of the .NET Framework.

Friday, November 21, 2008

Sitemap

XML Dom in chrome

Data connectivity related terminologies

Basic database terms

Thursday, November 20, 2008

XML Dom in chrome

As all know we usually use this ActiveXObject for IE like this:

xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async=false;
xmlDoc.onreadystatechange=verify;
xmlDoc.load(xmlFile);

but problem comes when i try to run same code in Mozilla or chrome

then find that Mozilla problem can be solved by following code:

xmlDoc=document.implementation.createDocument("","",null);
xmlDoc.load(xmlFile);
xmlObj=xmlDoc.documentElement;
var tnode = xmlObj.childNodes.length;

for(e=0;e {
text = xmlObj.childNodes[e].childNodes[0].firstChild.nodeValue;
value =xmlObj.childNodes[e].childNodes[1].firstChild.nodeValue;
}

But again I stuck while calling same code file in chrome

So after searching a lot, I found this better way as it supports both Mozilla and chrome browser

var xmlDoc= new window.XMLHttpRequest();
if(xmlDoc.overrideMimeType)
{
xmlDoc.overrideMimeType('text/xml');
}
xmlDoc.open("GET",url,false);
xmlDoc.send(null);
var xmlDoc1 = xmlDoc.responseXML;
var x=xmlDoc1.getElementsByTagName("item");
for(e=0;e {
var text = x[e].getElementsByTagName("category")[0].textContent;
var value =x[e].getElementsByTagName("id")[0].textContent;
alert(text);
alert(value);
}

Look the code above you can notice that in place of nodevalue we use textcontent as nodevalue give u null value.

Hope this will work out.
Enjoy :)

Data connectivity related terminologies

Database Connection

A database connection represents a communication channel between you application and database management system (DBMS). The application uses this connection to pass the commands and queries to the database and obtain the results of the operations from the database.

Data Reader

The data reader is a component that reads the data from the database management system and provides it to the application. The data reader works in the connected manner; it reads a record from the DB, pass it to the application, then reads another.

Tuesday, November 18, 2008

Basic database terms

Primary Key
A column or set of columns that uniquely identify all the rows in a table. Primary keys do not allow null values. No two rows can have the same primary key value; therefore, a primary key value always uniquely identifies a single row. More than one key can uniquely identify rows in a table, each of these keys is called a candidate key. Only one candidate can be chosen as the primary key of a table; all other candidate keys are known as alternate keys. Although tables are not required to have primary keys, it is good practice to define them. In a normalized table, all of the data values in each row are fully dependent on the primary key. For example, in a normalized employee table that has EmployeeID as the primary key, all of the columns should contain data related to a specific employee. This table does not have the column DepartmentName because the name of the department is dependent on a department ID, not on an employee ID.

Triggers
Triggers A stored procedure that executes when data in a specified table is modified. Triggers are often created to enforce referential integrity or consistency among logically related data in different tables.

Index
Index In a relational database, a database object that provides fast access to data in the rows of a table, based on key values. Indexes can also enforce uniqueness on the rows in a table. SQL Server supports clustered and nonclustered indexes. The primary key of a table is automatically indexed. In full-text search, a full-text index stores information about significant words and their location within a given column. Clustered index An index in which the logical order of the key values determines the physical order of the corresponding rows in a table. Nonclustered index An index in which the logical order of the index is different than the physical, stored order of the rows on disk.

Constraint
A property assigned to a table column that prevents certain types of invalid data values from being placed in the column. For example, a UNIQUE or PRIMARY KEY constraint prevents you from inserting a value that is a duplicate of an existing value, a CHECK constraint prevents you from inserting a value that does not match a search condition, and NOT NULL prevents you from inserting a NULL value.

Stored Procedures
A precompiled collection of Transact-SQL statements stored under a name and processed as a unit. SQL Server supplies stored procedures for managing SQL Server and displaying information about databases and users. SQL Server-supplied stored procedures are called system-stored procedures.

Functions
A piece of code that operates as a single logical unit. A function is called by name, accepts optional input parameters, and returns a status and optional output parameters. Many programming languages support functions, including C, Visual Basic, and Transact-SQL. Transact-SQL supplies built-in functions, which cannot be modified, and supports user-defined functions, which can be created and modified by users.

View
A database object that can be referenced the same way as a table in SQL statements. Views are defined using a SELECT statement and are analogous to an object that contains the result set of this statement.