40. What are different isolation levels of
a transaction object in ADO.NET?
ReadUncommitted: Does not lock the records
being read. This means that an uncommitted change can be read and then rolled
back by another client, resulting in a local copy of a record that is not
consistent with what is stored in the database. This is called a dirty read
because the data is inconsistent.
Chaos: Behaves the same way as ReadUncommitted, but checks the
isolation level of other pending transactions during a write operation so that
transactions with more restrictive isolation levels are not overwritten.
ReadCommitted: Locks the records being read and
immediately frees the lock as soon as the records have been read. This prevents
any changes from being read before they are committed, but it does not prevent
records from being added, deleted, or changed by other clients during the
transaction. This is the default isolation level.
RepeatableRead: Locks the records being read and keeps
the lock until the transaction completes. This ensures that the data being read
does not change during the transaction.
Serializable: Locks the entire data set being read and
keeps the lock until the transaction completes. This ensures that the data and
its order within the database do not change during the transaction.
41. What is the default isolation level in
a transaction?
ReadCommitted
42. What is a Save Point in a transaction
in ADO.NET?
SqlConnection object provide one
transaction capability that is unavailable for OLE database connections: the
ability to create save points within a transaction. Save points let you restore
the database state to a specific position within the current transaction. To
set a save point within a SQL transaction, use the Save method as shown below.
TransactionObject.Save("FirstStep");
43. How do you restore a SQL transaction
to a specific save point?
To restore a SQL transaction to a save
point, specify the name of the save point in the Rollback method as shown
below.
TransactionObject.Rollback("FirstStep");
44. What are ASP.NET Validation controls?
ASP.NET provides validation controls to
help you check Web form data entries before the data is accepted and saved in
the Database. Validation controls can be used to address the following
questions.
1. Did the user enter anything?
2. Is the entry the appropriate kind of
data (For example, Date of Birth should be a valid Date, Name should be a
string etc.)?
3. Is the data within a required range?
(For example age cannot be greater than 100 years)
The validation controls check the validity
of data entered in associated server controls on the client before the page is
posted back to the server. Most validity problems can be caught and corrected
by the user without a round-trip to the server.
45. Where do the ASP.NET validation
controls validate data, on the Client or on the Web Server?
ASP.NET validation controls validate data
first on the client and then on the web server. If a client disables javascript
on the browser then, client side validations are bypassed and validations are
performed on the web server.
Client-side validation is provided by a
JScript library named WebUIValidation.js, which is downloaded separately to the
client. Validation controls also automatically provide server-side validation.
Server-side validation is always performed, whether or not client-side
validation has occurred. This double-checking ensures that custom validations
are performed correctly and that client-side validation has not been
circumvented.
46. What are the 6 different validation
controls provided by ASP.NET?
RequiredFieldValidator: Checks whether a
control contains data
CompareValidator: Checks whether an
entered item matches an entry in another control
RangeValidator: Checks whether an entered
item is between two values
RegularExpressionValidator: Checks whether
an entered item matches a specified format
CustomValidator: Checks the validity of an
entered item using a client-side script or a server-side code, or both
ValidationSummary: Displays validation
errors in a central location or display a general validation error description
47. What property of the validation
control is used to specify which control to validate?
ControlToValidate property.
48. Explain in simple steps how to use
validation controls?
1. Draw a validation control on a Web form
and set its ControlToValidate property to the control you want to validate.
2. If you’re using the CompareValidator
control, you also need to specify the ControlToCompare property.
3. Set the validation control’s
ErrorMessage property to the error message you want displayed if the control’s
data is not valid.
4. Set the validation control’s Text
property if you want the validation control to display a message other than the
message in the ErrorMessage property when an error occurs. Setting the Text
property lets you briefly indicate where the error occurred on the form and
display the longer ErrorMessage property in a ValidationSummary control.
5. Draw a ValidationSummary control on the
Web form to display the error messages from the validation controls in one
place.
6. Provide a control that triggers a
postback event. Although validation occurs on the client side, validation
doesn’t start until a postback is requested.
49. Are the validation controls fired on
the client side if javascript is disabled on the client browser?
No, validation controls are not fired on
the client side if javascript is disabled on the client browser.
50. What is the use of CausesValidation
property of an ASP.NET button control?
CausesValidation property of an ASP.NET
button control is used to determine if the validation controls should be fired
when the button is clicked. If CausesValidation property is set to true, then
validation is performed and if the CausesValidation property is set to false
then validation is not done.
https://www.youtube.com/channel/UCKLRUr6U5OFeu7FLOpQ-FSw/videos
0 comments
Post a Comment