ADO.NET provides the efficient way to manipulate the database. It contains the following major components are :
* DataSet Object
* Data Providers :
›› Connection Object
››Command Object
››DataReader Object
››DataAdapter Object
Posted Date:- 2021-09-18 09:47:58
Role-based security is used to implement security measures in .NET, based on the roles assigned to the users in the organization. In the organization, authorization of users is done based on their roles.
For example, windows have role-based access like administrators, users, and guests
Posted Date:- 2021-09-18 09:46:06
MDI (Multiple Document Interface): An MDI allows you to open multiple windows, it will have one parent window and as many child windows. The components are shared from the parent window like toolbar, menubar, etc.
SDI (Single Document Interface): SDI opens each document in a separate window. Each window has its own components like a toolbar, menubar, etc. Therefore it is not constrained to the parent window.
Posted Date:- 2021-09-18 09:45:20
Code Access Security(CAS) is necessary to prevent unauthorized access to programs and resources in the runtime. It is designed to solve the issues faced when obtaining code from external sources, which may contain bugs and vulnerabilities that make the user’s system vulnerable.
CAS gives limited access to code to perform only certain operations instead of providing all at a given point in time. CAS constructs a part of the native .NET security architecture.
Posted Date:- 2021-09-18 09:44:36
A delegate is a .NET object which defines a method signature and it can pass a function as a parameter.
Delegate always points to a method that matches its specific signature. Users can encapsulate the reference of a method in a delegate object.
When we pass the delegate object in a program, it will call the referenced method. To create a custom event in a class, we can make use of delegate.
Posted Date:- 2021-09-18 09:43:35
MSIL is the Microsoft Intermediate Language, which provides instructions for calling methods, memory handling, storing and initializing values, exception handling, and so on.
The instructions provided by MSIL are platform-independent and are generated by the language-specific compiler from the source code. JIT compiler compiles the MSIL into machine code based on the requirement.
Posted Date:- 2021-09-18 09:42:45
There is no difference between int and Int32. Int32 is a type provided by the .NET framework class whereas int is an alias name for Int32 in the C# programming language.
Posted Date:- 2021-09-18 09:41:47
* 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(a single value normally) – SQL Functions like MIN(), NAX().
Posted Date:- 2021-09-18 09:41:07
No, only the OleDbDataReader and OleDbConnection object need to be closed explicitly.
Posted Date:- 2021-09-18 09:39:03
params keyword is used as to accept variable number of parameters.
Posted Date:- 2021-09-18 09:37:17
The SqlCommand and OleDbCommand classes are used to execute SQL commands using ADO.NET.
Posted Date:- 2021-09-18 09:35:25
Use the SqlConnection and OleDbConnection classes to connect to a database using ADO.NET.
Posted Date:- 2021-09-18 09:34:47
Use the SqlDataReader and OldDbDataReader classes to read data in a forward direction only.
Posted Date:- 2021-09-18 09:33:20
The Execute Scalar method executes SQL commands that return single values.
Posted Date:- 2021-09-18 09:32:46
No, only the OleDbDataReader and OleDbConnection object need to be closed explicitly.
Posted Date:- 2021-09-18 09:31:02
There are two main differences are :
* Dataset you an retrieve data from two databases like oracle and sql server and merge them in one dataset.
* Recordset this is not possible
* All representation of Dataset is using XML while recordset uses COM.
* Recordset can not be transmitted on HTTP while Dataset can be.
Posted Date:- 2021-09-18 09:30:14
Parameter object is used to pass the parameter value to a stored procedure.
Posted Date:- 2021-09-18 09:29:08
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.
Posted Date:- 2021-09-18 09:27:59
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.
Posted Date:- 2021-09-18 09:26:48
DataAdapter' fill () method is used to fill load the data in dataset.
Posted Date:- 2021-09-18 09:26:07
* Dataset can fetch source data from many tables at a time, for Recordset you can achieve the same only using the SQL joins.
* A DataSet can represent an entire relational database in memory, complete with tables, relations, and views, A Recordset 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.
Posted Date:- 2021-09-18 09:24:54
In Pessimistic locking when user wants to update data it locks the record and till then no one can update data.
In Optimistic locking multiple users can open the same record for updating, thus increase maximum concurrency.
Posted Date:- 2021-09-18 09:22:48
The Execute Non Query method executes SQL commands that don't return a result set.
Posted Date:- 2021-09-18 09:21:35
The preferred method is to use the sqlParameter and oleDbParameter objects, as detailed in the section "Using Parameters with the command Object."
Posted Date:- 2021-09-18 09:20:40
The Sqlcommand and Oledb command classes are used to execute SQL Commands using ADO.NET.
Posted Date:- 2021-09-18 09:18:28
The BindingSource class is used to simplify data binding as well as various operations on records. It has different methods like AddNew( ), MoveFirst( ), MovePrevious( ), MoveNext( ), etc which provide easier way for adding new row, moving to first record, moving to previous record, moving to next record and many other operations without writing code for them.
Posted Date:- 2021-09-18 09:14:04
The GetChanges method of DataSet can be used to retrieve the rows that have been modified since the last time DataSet was filled, saved or updated. The GetChanges method returns a DataSet object with modified rows.
Posted Date:- 2021-09-18 09:12:46
<> DataSet is good for ADO.NET objects to replace the ADO Recordset object:
<> DataSet can hold multiple tables at a time.
<> It allows data access to easily read or write data operations in / from the database.
<> DataSet data stores in local system.
<> It holds multiple rows at a time.
<> It uses more memory.
<> DataSet maintain relation.
<> It bind data from the database.
Posted Date:- 2021-09-18 09:10:55
The preferred method is to use the SqlParameter and oleDbParameter objects, as detailed in the section "Using Parameters with the command Object."
The SqlParameter class is found in the "System.Data.SqlClient" namespace. It is a class of a connected architecture of .NET framework. It represents parameters. To work with the SqlParameter class we should have a database.
Posted Date:- 2021-09-18 09:09:27
XML Schema A description of the data elements contained in an XML file. The XML Schema provides the names of the elements, their types, whether or not they are key fields, and other information.
Posted Date:- 2021-09-18 09:06:13
The ExecuteNonQuery method is used to execute the command and return the number of rows affected.
The ExecuteNonQuery method cannot be used to return the result set.
Snippets working with ExecuteNonQuery
public void CallExecuteNonQuery()
{
SqlConnection conn = new SqlConnection();
conn.ConnectionString = ConfigurationManager.ConnectionStrings["connString"].ConnectionString;
try
{
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandText = "DELETE FROM EMP WHERE DEPTNO = 40";
cmd.CommandType = CommandType.Text;
conn.Open();
Int32 RowsAffected = cmd.ExecuteNonQuery();
MessageBox.Show(RowsAffected + " rows affected", "Message");
cmd.Dispose();
conn.Dispose();
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
}
Posted Date:- 2021-09-18 09:05:28
ransaction A group of commands (treated as a single unit) that change the data stored in a database. The transaction ensures that the commands are handled in an all-or-nothing fashion—if one of the commands fails, all of the commands fail, and any data that was written to the database by the commands is backed out. In this way, transactions maintain the integrity of data in a database.
Posted Date:- 2021-09-18 09:02:52
The three general namespaces are System.Data, System.Data.Common and System.Data.SqlTypes. Some of the provider-specific namespaces are System.Data.OleDb, Microsoft.Data.Odbc and System.Data.SqlClient.
The System.Data namespace defines classes that you can use with all the data providers or without data providers at all. This namespace also defines interfaces that are base classes for the data provider classes. The following figure shows the System.Data namespace class hierarchy.
Posted Date:- 2021-09-18 09:02:00
The DataSet is a disconnected, in-memory representation of data. It can be thought of as a local copy of the relevant portions of a database. Data can be loaded into a DataSet from any valid data source, such as a SQL Server database, a Microsoft Access database, or an XML file. The DataSet persists in memory, and the data therein can be manipulated and updated independent of the database
Posted Date:- 2021-09-18 09:01:15
To read data from an XML file into a dataset, you can use the ReadXML method of the dataset, specifying the stream or file that contains the XML data. To write data to a file, you can use the WriteXML method of the dataset, again specifying either the file or the stream that represents the file. The GetXML method of the dataset can be used to retrieve a string representation of the XML data contained by a dataset.
Posted Date:- 2021-09-18 08:59:03
OLEDBReader and OLEDBConnection object need to be clogged. This will reside in memory if it is not correctly closed.
Posted Date:- 2021-09-18 08:53:48
Most important features of ADO.NET 2.0:
Bulk Copy Operation: It facilitates bulk copy operation from one Data Source to another Data Source.
Batch Update: To update n no of rows in a database table in a single call from a program thus by avoiding round trip to the database.
Data Paging: To read data from a certain index
Connection Details: To get detailed info about connections like buffer information, cursor details, etc.
DataSet.RemotingFormat Property: To make the dataset serialized in Binary
DataTable's Load and Save Methods: For XML interactions.
Posted Date:- 2021-09-18 08:52:33
Most important features of ADO.NET 2.0:
Bulk Copy Operation: It facilitates bulk copy operation from one Data Source to another Data Source.
Batch Update: To update n no of rows in a database table in a single call from a program thus by avoiding round trip to the database.
Data Paging: To read data from a certain index
Connection Details: To get detailed info about connections like buffer information, cursor details, etc.
DataSet.RemotingFormat Property: To make the dataset serialized in Binary
DataTable's Load and Save Methods: For XML interactions.
Posted Date:- 2021-09-18 08:52:24
Typed datasets use explicit names and data types for their members but untyped dataset uses table and columns for their members.
Posted Date:- 2021-09-18 08:50:04
DataSet object is one of the major components of ADO.NET. It always remains disconnected from the database and reduces the load on the database.
Posted Date:- 2021-09-18 08:49:09
Different methods are:
<> Merging with another dataset
<> Data from XML Documents
<> Programmatically creating data row, data table and data column objects.
<> Using data adapter objects and the “fill†process
Posted Date:- 2021-09-18 08:48:09
A batch update can be distinct as a batch of updates grouped. To perk up the presentation of the data updates in a database is to inform and send the changes in batches to the database, slightly than one by one.
Posted Date:- 2021-09-18 08:47:07
Data binding is the procedure of binding the data with graphical elements. After binding the data in a window shape, you can steer through the records with the help of the Binding Navigator Control.
Posted Date:- 2021-09-18 08:46:40
The challenges include:
1. More than one user might need to access the data simultaneously from one database.
2. More than one user might need to access the data anytime, anywhere.
The solution to this problem is attained by implementing a ‘Database locking’ during the time of transaction execution.
Posted Date:- 2021-09-18 08:44:44
To connect to the database server is recommended to use Windows Authentication, commonly known as integrated security. To specify the Windows authentication, you can use any of the following two key-value pairs with the data provider. NET Framework for SQL Server:
Integrated Security = true;
Integrated Security = SSPI;
However, only the second works with the data provider .NET Framework OleDb. If you set Integrated Security = true for ConnectionString an exception is thrown.
Posted Date:- 2021-09-18 08:42:52
ExecuteScalar is typically used when your query returns a single value. If it returns more, then the result is the first column of the first row. An example might be SELECT @@IDENTITY AS 'Identity'.
ExecuteReader is used for any result set with multiple rows/columns (e.g., SELECT col1, col2 from sometable).
ExecuteNonQuery is typically used for SQL statements without results (e.g., UPDATE, INSERT, etc.).
Posted Date:- 2021-09-18 08:41:49
It is the process of improving the performance of the database by adding redundant data.
Posted Date:- 2021-09-18 08:40:35
<> Atomicity: It ensures all-or-none rule for database modifications.
<> Consistency: Data values are consistent across the database.
<> Isolation: Two transactions are said to be independent of one another.
<> Durability: Data is not lost even at the time of server failure.
Posted Date:- 2021-09-18 08:39:34
SQL Server should authenticate before performing any activity in the database. There are two types of authentication:
Windows Authentication – Use authentication using Windows domain accounts only.
SQL Server and Windows Authentication Mode – Authentication provided with the combination of both Windows and SQL Server Authentication.
Posted Date:- 2021-09-18 08:38:21
<> Connection Oriented means : connection is exist throw out your process. Example : using DataReader in ADO.NET you can get data as connection oriented database connection type.
<> Connection Less means : Your connection is not available throw out your whole process. Example: using DataAdapter in ADO.NET you can get data as connection less database connection type.
Posted Date:- 2021-09-18 08:37:52