Monday, December 29, 2008

Interview Questions - Part 4

Interview Questions

36. what are the differences between Ado and
a.) Ado:
1. It supports connected model
2. xml support is less
3. It uses record set
1. It supports disconnected model
2. xml support is more
3. it uses data set

37. What are the basic objects needed for Ado.Net
a.) There are 5 main objects.
1. Connection object: used to open a connection to the database
2. command object: used to perform operations on database
3. datareader object: used to read data in forward only read only manner from database
4. DataAdapter: Acts as a bridge between Dataset and Dataset
5. Dtaset: In-Memory container for all your data.

38. What are the arguments of a connection object?
a.) 1. server : this is used to specify the server name.
2. InitialCatalog: This is used to specify the database name
3. usedID: specifies the user id
4. password: specifies the user password.

39. Which method is used to release resources on connection object?
a.) Dispose() method.

40. What are the namespaces required to use
a.) System
System.Data.SqlClient (or) System.Data.OleDb (OR) system.Data.Odbc (OR) system.Data.OracleClient.

41. What is a Dataset?
a.) Dataset is a simple, in-memory data store for your data. It contains data, constraints on data, and relationships between data. It supports disconnected model, means connection is opened when the request is made and it closes when request is served with response. It can contain data from more than one table or database.

42. Why we use AcceptChanges method ?
a.) This is the method used by Dataset to commit the changes done by DML statements.

43. What is Getchanges method?
a.) This is used to get only those rows which have been modified. This can be used on a datatable or dataset.

44. What is a DataReader?
a.) DataReader is used to read data in forward only and read only manner.
Read() method is used to read data from database using datareader. They support connected model. Performance is more as they read data in forward only and read only manner. It can’t read data from more than one table at any point of time.

45. What are the methods we can apply on dataReader?
a.) 1.Read(): used to read
2.Close(): Used to close datareader
3.IsClosed(): used to check whether datareader is closed or not
4.HasRows(): used to check whether there are rows or not
5.NextResult(): with this we can execute a set of sql statements

No comments: