ADO.NET Interview Questions

Showing Questions 21 - 27 of 27 Questions
First | Prev | Next | Last Page
Sort by: 
 | 
Jump to Page:
  •  

    What is the default view of Data Grid?

    Star Read Best Answer

    Editorial / Best Answer

    spandanapotla  

    • Member Since Mar-2008 | Apr 2nd, 2008


    The DataGrid default view is tabular form and optionally supports selecting, sorting, paging, and editing the data

  •  

    What is the difference between data reader and data adapter ?

    Star Read Best Answer

    Editorial / Best Answer

    Answered by: Madhukar Singh

    • Aug 11th, 2006


    DateReader is an forward only and read only cursor type if you are accessing data through DataRead 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.

    nikhiljain27

    • Jul 13th, 2013

    Datareader- works in fast forward read only mode to fetch data from the database. It works in connected environment.
    DataAdapter- Works as a bridge between the database and Ado.net and Fills the dataset. It works as a bridge to work in a disconnected environment.

    Deepak

    • Feb 15th, 2013

    1. A DataReader works in a connected environment, whereas DataSet works in a disconnected environment.

    2. A DataSet represents an in-memory cache of data consisting of any number of inter related DataTable objects. A DataTable object represents a tabular block of in-memory data.

  •  

    What are the steps to connect to a database?

    Star Read Best Answer

    Editorial / Best Answer

    nishant2200  

    • Member Since Jan-2007 | Jan 7th, 2007


    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.

    johnjustin

    • Apr 8th, 2008

    1. Implements the base class for data access2. Create a connection3. Open that connection4. Create a data reader and execute the data reader with proper sql statements You can get the values of the record using the methods GetString, GetInt32 ....etc.

  •  

    Difference between ado.net data set and ADO Record set

    Star Read Best Answer

    Editorial / Best Answer

    ramakrishnag1982  

    • Member Since Nov-2006 | Aug 12th, 2007


    1) A DataSet can represent an entire relational database in memory, complete with tables, relations, and views, A Recordset can not.

    2) A DataSet is designed to work without any continuing connection to the original data source; Recordset maintains the contentious connection with the original data source.

    3) There's no concept of cursor types in a DataSet, They are bulk loaded, while Recordset work with cursors and they are loaded on demand.

    4) DataSets have no current record pointer, you can use For Each loops to move through the data. Recordsets have pointers to move through them.

    Kishore

    • Jan 24th, 2013

    Please need some more related information about the each topic..It is not sufficient to answer in Interviews.

    sathin

    • Oct 29th, 2009

    To get the data from a database and put it on a data control In ADO they used recordset In ADO.Net they used dataset Record set is a connection oriented architecture whereas dataset supports a c...

  •  

    Database Method

    If we are not returning any records from the database, which method is to be used?

    Star Read Best Answer

    Editorial / Best Answer

    Pendurti  

    • Member Since Sep-2008 | Sep 11th, 2008


    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 to copy the contents from one table to another table and how to delete the source table in ado.net?

    Star Read Best Answer

    Editorial / Best Answer

    samiksc  

    • Member Since Oct-2005 | Jul 12th, 2007


    The question can mean 2 tasks -
    1. Copy one 'datatable' to another and delete the source 'datatable' OR
    2. Copy one database table (say a table in sql server database) to another database table, and delete the source table which is in the SQL server database. This operation is to be performed using ADO.Net

    Answers:
    1. DataTable newOne = originalOne.Copy(); originalOne.Dispose(); -- Note that originalOne.Clear() will simply delete all rows from the table, but the table object with its structure will remain there.
    2. Run DDL commands using 'ExecuteNonQuery' method of DataCommand object.
    e.g. string cmdText1 = "create table newOne as select * from originalOne" (copy table to another)
    string cmdText2 = "drop table originalOne";
    DataCommand dataCmd = new SqlDataCommand(cmdText1, conn);
    conn.Open();
    dataCmd.ExecuteNonQuery();
    dataCmd.CommandText = cmdText2;
    dataCmd.ExecuteNonQuery();
    conn.Close();

    sathin

    • Oct 29th, 2009

    This is definitely possible. I tried making it simple by talking two gridviews in the design part and writing the below code when you try creating a datatable do avoid the new keyword Imports S...

  •  

    What is ADO.NET

    Star Read Best Answer

    Editorial / Best Answer

    Ranjit  

    • Member Since Oct-2005 | Nov 28th, 2005


    ADO.NET is the primary relational data access model for Microsoft .NET-based applications. It may be used to access data sources for which there is a specific .NET Provider, or, via a .NET Bridge Provider, for which there is a specific OLE DB Provider, ODBC Driver, or JDBC Driver. ADO.NET is sometimes considered an evolution of ADO technology, but it is important to note that some major changes were made between the two.

    Pendurti

    • Sep 11th, 2008

    ADO.NET is something that allows us to interact with relational databases and other data sources. It is a technology that ASP.NET applications use to communicate with a database, whether we need to add a new customer record, make a  purchase, or display a product catalog. 

Showing Questions 21 - 27 of 27 Questions
First | Prev | Next | Last Page
Sort by: 
 | 
Jump to Page: