Skip to main content

Posts

Showing posts from April, 2012

How to set deadlock priority in sql server

Introduction: In my previous article I have explained about Insert values into identity column in sql server . In this article I am going to explain about how to set the DEADLOCK_PRIORITY  in sql server. Explanation: DEADLOCK_PRIORITY Specifies the relative importance that the current session continue processing if it is deadlocked with another session.

Insert values into identity column in sql server

Introduction: In my previous article I have explained about Use of SET NOCOUNT in sql server . In this article I am going to explain about how to insert values into identity column or the use of  SET IDENTITY_INSERT in sql server. Explanation: SET IDENTITY_INSERT Allows explicit values to be inserted into the identity column of a table.

Use of SET NOCOUNT in sql server

Introduction: In my previous article I have explained about  how to Restrict the number of rows affected in SQL Server . In  this article I will explain about the use of in SET NOCOUNT sql server. Explanation: When SET NOCOUNT is ON , the count is not returned. When SET NOCOUNT is OFF , the count is returned. The @@ROWCOUNT function is updated even when SET NOCOUNT is ON . SET NOCOUNT ON prevents the sending of DONE_IN_PROC messages to the client for each statement in a stored procedure. For stored procedures that contain several statements that do not return much actual data, setting SET NOCOUNT ON can provide a significant performance boost, because network traffic is greatly reduced. The setting specified by SET NOCOUNT is in effect at execute or run time and not at parse time. Syntax: SET NOCOUNT { ON | OFF } Examples: The following example prevents the message about the number of rows affected from being displayed.

Restrict the number of rows affected in SQL Server

Introduction: In my previous article I have explained about  how to Get number of affected rows in sql . In  this article I will explain about how to restrict the number of rows affected in  sql server. Explanation: To restrict the number of rows affected by sql server   SET ROWCOUNT is used. It Causes SQL Server to stop processing the query after the specified number of rows are returned.

Get number of affected rows in sql

Introduction: In my previous article I have explained about  how to Different isolation levels in sql server . In  this article I will explain about different how to get the number of rows affected or the use of  @@ROWCOUNT in sql server. Explanation: To get the number of rows affected by a query below sql query is used.

Different Isolation levels in sql server

Introduction: In my previous article I have explained about  how to Get system name using sql or c#.net . In  this article I will explain about different transaction levels in sql server. And which one we should use for better performance. Explanation: Transaction isolation level Controls the default transaction locking behavior for all Microsoft SQL Server SELECT statements issued by a connection. Different transaction isolation levels are ·         READ COMMITTED ·         READ UNCOMMITTED ·         REPEATABLE READ ·         SERIALIZABLE ·         SNAPSHOT

Check textbox is changed or not using javascript C#.net

Introduction: In my previous article I am explained about the Check uncheck all checkboxes in grid view using jquery  .  In this article I am going to explain about how to check whether the textbox value is changed or not using javascript and c#.net. Explanation: While working in a project I came to the following situation. There is a textbox in my webpage and i want to submit form only if the textbox's value has changed  else i want to show some validation message. For this I have written code both in C#.net and javascript.  

Check uncheck all checkboxes in grid view using jquery

Introduction:                                    In my previous article I have explained about   Select deselect all checkboxes in grid view using javascript . In this article I am going to explain the same process using jquery.   Explanation: While working with grid view I got a requirement to select and deselect all checkboxes in a grid view in a single click. For this first create a table and insert some sample records in the table. I am binding the gridview through the procedure at the page load. And at the end I have two buttons which is used for select/deselect all checkboxes.

Get selected value of radio button list in javascript

Introduction: In my previous article I have explained about Select Unselect all checkboxes in gridview . In this article I am going to explain the process of getting the value of a radiobutton list in javascript.   Explanation: For explaining the process I have a radio button list with 5 listitems. I am calling GetRDBValue function in onclick event of the radio button list. Below is the aspx code.  

Select deselect all checkboxes in grid view using javascript

Introduction: In my previous article I have explained about  Get Ip address/domain of the domain/Ip address in C#.Net     In this article I am going to explain the process of select and deselect all checkboxes in a gridview.   Explanation: While working with grid view I got a requirement to select and deselect all checkboxes in a grid view in a single click. For this first create a table and insert some sample records in the table. I am binding the gridview through the procedure at the page load. And at the end I have two buttons which is used for select/deselect all checkboxes.

Get Ip address/domain of the domain/ip address in C#.Net

Introduction: In my previous article I have explained about  hoe to Restrict ip,user agent,crawlers in asp.net global.asax . In this article I am going to explain about how to get the ip addess of the domain. Explanation: While working in a project I came to the situation like to restrict all the ips except my domain ip. In my previous article I have explained about to restrict particular ips. To get the ip address of the domain include the below namespace  in  code behind.

Restrict ip,user agent,crawlers in asp.net global.asax

Introduction: In this article I am going to explain about how to allow or restrict particular ips and user agents and crawlers in global.asax file in asp.net/c#.net. Explanation: Some internal applications which is used only by particular organization or required to restrict other ips other than their office ips. And also we may restrict the search engines and other crawlers from our competitive sites. For the explanation purpose I have a xml called whitlist.xml which contains all the ip addresses which is to be allowed and user agents which is to be allowed. And important point to know is crawlwers won’t have the cookie for that session . Below is the xml file format.

Disable Enable textbox using javascript

Introduction: In this article I am going to explain about the javascript code used for disabling and enabling and also the disadvantages of disabling the textboxes and the alternatives for this. Explanation: While programming for security reasons or for some other reasons we supposed to disable certain Textboxes.  For disabling the textbox we have to set the disabled property  to true using javascript. The javascript code for disabling textbox is given below.  

Dynamically programmatically add title,description and keywords to page in C#.net

Introduction: In this article I am going to explain about the c# code used for adding  meta tags like title,  description and keywords to page . Explanation: While programming some times we suppose to add meta tags like title description and keywords dynamically. Since meta tags like keywords and description is very important for search engine optimization we supposed to add unique meta tags for each page.

how to add double quotation to string using C#.net

Introduction: In this article i am going to explain a simple thin that is adding double quotes to the string in C#.Net. Explanation: While forming the string or query in c# we may pace the situation where we supposed to add double quotes to the string. We can add double quote to the string by prefixing \ before the double qoute. or by specifying the string between " string " 

Loop through json data using javascript

Introduction: In this article I am going to explain about how to loop through the JSON. It is explained using two drop down values which means for city and std codes. Explanation: In  our code we have two drop down lists. One for selecting city and another one for loading the corresponding stdcodes. The javascript function is used to loop through this json data. In this javascript code we first removing all the items from the stdcode dropdown. After that we are getting the comma separated values of the particular selected city. Then we are splitting the comma separated stdcodes and loading it to the stdcode drop down. The source code for this is given below

Query to find non indexed table in sql server

Introduction: In this article I am going to explain about the query used to get the table with clustered index or primary key in sql server. Explanation: Indexed table will boost the performance of a query by reducing the query cost. So it is necessary to fid out the tables without the clustered index or primary key. Below query is used to get the tables in a data base without clustered index or primary key

Preselect html select/drop down value based on text in asp.net

Introduction: In this article I am going to explain about how to preselect asp drop down or html select value based on a text. Description: In some cases we are in the situation to preselect the drop down or html select option based on some text. Here I am explaining this process using javascript code. For the explanation purpose I have a form. In that form I have a html select with id “ select_cities ”. This select have three options and each option have some values. In this scenario I am supposed to select the option with the text “Kanna”. For this I have written a javascript function “test”.Below is the code used.

Disable cut copy paste operation on a textbox using asp.net/javascript

Introduction: In this article I am going to explain about how to disable cut , copy and paste operation on a textbox Description: Some time for some security purpose we need to restrict the user from cut,copy and paste operation on a textbox. We can achieve it using a simple code which is given below. For this we are using three client side events oncopy,onpaste,oncut. Code: < asp : TextBox ID ="txtTest" runat ="server" oncopy ="return false" onpaste ="return false"     oncut ="return false"> </ asp : TextBox > Thus the above code returns false on cut, copy and paste operation. Do you like this article. Then comment here or share with your friends. Or like our facebook page.

Find difference between two dates using javascript

Introduction; In this article I am going to explain about how we can findout the difference between two dates using javascript. Description: Many time we supposed to do some validations on client level to make the data valid. Like this here I an explaining about how we can finout difference between startdate and end date and how we can restrict the form submission based on that. For explaining purpose I am considering that the date entered both in startdate and enddate field will be in the “MM-DD-YYYY”.  And our condition is if the date difference between the two dates is greater than 7 then it will show the alert message. The necessary ASP.Net code and the javascript code is given below.

Refresh page periodically in C#.Net/ASP.Net

Introduction: In this article we are going to discuss about how to refresh the page periodically using c#.code or html meta tag. Description: Some time we face the situation like represhing the page periodiclly. In this article i am going to explain about refreshing the page periodically using html and C# code. In HTML to do this periodic refresh we are using the meta tag with the attribute  http-equiv="refresh".  Below is the HTML code for refreshing the page.

Form hyperlink with querystring inside gridview in ASP.Net/C#.Net

Introduction: In this article I am going to explain forming the hyperlink inside a gridview with the querystring. Description: In the previous article I have explained about how to pass the query string of a page to a hyperlink as a querystring. In this article I am explaining the way of forming hyperlink inside gridview. In the below code there is a gridview with id grdgridview. Inside the gridview I have the hyperlink with two querystring values id and name. The navigate url string is given in the attribute DataNavigateUrlFormatString . The value for the query string is specified in the attribute   DataNavigateUrlFields .

Add query string value to hyperlink in C#.net/Asp.Net

Introduction: In this article I am going to explain you about how to pass the query string value of a page to a hyperlink a page. Description: In the below example we are passing the query string in the url. The page have a hyperlink control. I am going to explain the process of passing the query string value as a query string to the hyperlink.

Comment code in c#.net and Asp.Net

Introduction: In this article I am going to explain about how to comment code in asp.net,c#.net. Description: For commenting single line code in c#.net we are using // at the starting of the line. To comment multiline code we are using /* at the start and */ at the end. In ASP.Net we are using   <% -- At the start of the code and -- %>  at the end of the code. Instead we can use the shortcut CTRL+K+C to comment both the C#.Net and Asp.Net code and CTRL+K+U for uncommenting the code.