Saturday, April 13, 2013
Friday, September 10, 2010
Get nth highest record from table
Select Min(Salary) from tbSalary where Salary In(Select top 3 Salary from tbSalary order by salary desc)
Here, I have fetched the 3rd highest record from the salary table. You can replace "3" with the record number you want to get.
Firstly, the inner query runs and orders the salary column in descending order. Than the inner query selects Top 3 records from the ordered list.
Secondly, the outer query fires and select the minimum salary from the list selected by the inner query, which gives the required record.
And that's it, u get the result....
One more thing, if u have a better solution, than do tell me here.....Happy querying.....
Friday, February 26, 2010
Common Type System ot C.T.S.
What is difference between Code behind and Inline Coding technique ?
Can we use more than one web.config file in our application ?
What is IIS ?
Page.IsPostBack property
What is M.S.I.L. or Microsoft Intermediate Language
Main components of .Net Framework
Difference between Page.ClientScript.RegisterStartupScript and ClientScript.RegisterClientScriptBlock ?
So placing your script on the page depends upon type of script.If the script uses a control than it should be placed at the bottom of the page rather than as controls will not be formed by the time script is fired.
Tuesday, June 2, 2009
Check for blank space in string using Javascript
<script type="text/javascript" language="javascript">
function check()
{
var Pattern=new RegExp(" ")
var val=pattern.exec(document.getElementById("<%=TextboxID.ClientID").value)
if(val==null)
{
alert("No space found");
}
else
{
alert("Blank space not allowed")
}
}
</script>
Finally this function can be called on event on which we want to check for the blank space in the string
Tuesday, May 19, 2009
Ajax Password Strength Extender
Steps to use Password Extender :
1. Add a Textbox on which the Extender is to be applied , on your Webform.
2. Apply the Password strength Extender to the Textbox.
3. Set the following properties for the Password Extender :
TargetControlID : The ID of the control on which Password strength is to be applied.
StrengthIndicatorType : Either text can be displayed or BarIndicator can be used.
PreferredPasswordLength : Length of the Password that should be used.
MinumumUpperCaseCharacters: Specifies the minimum Upper case alphabets required
MinumumLowerCaseCharacters: Specifies the minimum Lower case alphabets required
The above two properties are required only if the RequiresUpperandLowerCaseCharacters is specified as True.
Prefix Text : The text that is required to specify the strength of Password to the user.
Ex: Your Password strength is :
MinimumNumericCharacters : Specifies the minimum number of numeric values that should be used in Password.
MinimumSymbolCharacters : Specifies the minimum number of Special Symbols that should be used om Password
CalculationWeightings : Specifies the percentage strength of the various criterias used in the password. It reqiures 4 values with total of 100 is the maximum.
Ex : CalculationWeightings : 50;20;20;10 means Length forms 50 percent of total strength of the password ,Numeric forms 20 percent , Casing forms the 20percent and Special Symbols form the rest of the strength
DisplayPosition : The position where the Password strength should be displayed.
RequiresUpperandLowerCaseCharacters : Specifies whether the uppercase or lower caser alphabets are required.
HelpStatusLabelID : Specifies the ID of the Label control where the strength criteria is to be displayed to the user.
HelpHandleCSSClass :Specifies the CSS class for the Help control used to display the requirements.
HelpHandlePosition: Specifies the position of the Help Label being used.
TextStrengthDescription : Specifies the text for the strength level for the control
Ex : Average,Good,Very Good, Excellent. This property can be used when StrengthIndicatorType used is Text.
Ajax Mutually Exclusive Checkbox Extender
1. Add 2-3 Checkboxes on your webform.
2. Add the Mutually Exclusive Checkbox Extender to all the checkboxes.
Ajax Slider Extender
Friday, May 15, 2009
What is SQL
Wednesday, May 13, 2009
What is .Net Framework
1. Base Class Library (BCL): Base class library consists of predefined classes which help in performing various tasks like connectivity with the database, web development, accessing the database,security settings of applications etc. during development of an application. This library of classes is commonly shared by all the languages that are available in the .net framework. Some of these langauges include C#, Visual Basic etc.. Latest version of .Net framework 3.5 supports more than 90 languages.
2. Common Language Runtime (CLR) : This component of .net framework manages the execution of the code written in various langauges . A developer writes his/her code in C# or J#. At compile time , the .net compiler for these languages convert them into Intermediate Language (IL) or Microsoft Intermediate Language (MSIL). At run time , a component of CLR known as JIT Compiler converts this code into its native code that can be understood by the operating system. JIT compiler converts only the required code into native code and not whole of the code.
Apart from this , CLR also perform some important tasks which include :
(a) Memory management : It involves allocating required memory for the execution of a program and deallocating the same after the program is completed.
(b) Thread management : It involves managing execution of two or programs or processes running at the same time.
(c) Garbage Collection : This task is performed by garbage collector. Its job is to get back the memory allocated to the objects that will not be used again by the application .
(d) Exception Handling : Exception handling is a method to control the flow of execution of a program when an error occurs. When an error occurs, an exception is said to be raised.
Custom error in web.config
To show this page we only need to create a page with a message and add a line of code in our web.config file. Follow these steps and you are done.
1. Create your error message Page with any message like "Sorry for your inconvenience but the page you are trying to access is not available at the moment".
2. Go to web.config and look for "system.web"
3. Add the "customErrors" tag between its opening and closing tags and add following attributes for it:
customErrors="On/Off/RemoteOnly" defaultRediret="ErrorPage.aspx"
In case mode is set Off , there is no need to provide with defaultRedirect attribute.
The three modes are described as follows :
1. Off Mode : In this case , whenever an error occurs, the default Error page of ASP.Net is shown both to the remote user and the local user. This is the mode which shows the complete error and by default , this error mode is used.
2. On Mode : In this case, whenever an error occurs , the customized error page we have created is displayed both to the local user and the remote user. In this case , if we do not specify the error page to be used , error page shows how we can enable Remote Mode to view the error.
3. Remote Only : In this case , whenever an error occurs , our customized error page with our Message is displayed to the remote user and default error page is shown to the remote user. This mode is the best as it hides error message from the user and shows it only to the concerned user.
defaultRedirect="ErrorPage.aspx" attribute specifies the page where the user is to be redirected in case of any error . This attribute is added only in case Mode is set to either On or RemoteOnly
Tuesday, May 12, 2009
Joins in SQL
1 Inner Join : An inner join returns all the results for which the columns of the two linking tables match each other. For ex Table1 has Stu_ID , Stu_Name and Table2 has Stu_ID , DeptName . To get Dept Name for each student, we can use following querry using Inner Join.
This will return all the results for two tables for which the Stu_Id of the two tables match with each other. Even if the keyword Inner is not specified, it is taken as Inner Join
2. Outer Join: Outer join in SQL is further classified into two categories ....
(a) Left Outer Join : Left outer join selects all the entries for first table and only those entries of second table for which there is a match between the linked columns. If Left Outer join is applied in above case , the result will be all the entries from Table1 and only the entries from Table2 for which there is a match between the Stu_ID columns of the two columns . It is applied as :
Select Table1.Stu_Name,Table2.DeptName from Table1 Left Join Table2 Table1.StuID=Table2.Stu_ID(b) Right Outer Join : Right outer join selects some entries for first table for which there is a match between the two tables and all the entries of second table even if there is a not a match between the linked columns. If Right Outer join is applied in above case , the result will be all the entries from Table2 and only the entries from Table1 for which there is a match between the Stu_ID columns of the two columns . It is applied as :
Select Table1.Stu_Name,Table2.DeptName from Table1 Right Join Table2 Table1.StuID=Table2.Stu_ID
Primary Key , Unique Key ,Foreign Key
Unique Key : Unique is similar to Primary key except that null values are allowed in unique key. Also Non-Clustered indexing is implemented by the unique key constraint.
It implements the Entity integrity Constraint
Foreign Key : Foreign key concept is used to establish relation between two tables of a database . In this relationship , a column which is Primary Key for parent table , is referenced by column of a child table i.e. the two columns are linked to each other. The column which refers the Primary key of parent table , becomes the Foreign key for child table.
Monday, May 11, 2009
Constraints in SQL
1. Entity Constraints : It ensures that duplicate data is not inserted into the table. This is done by adding Primary Key constraint which ensures that a column can not have a duplicate value. For ex : To make sure that no value of a column named EmpId in a column is repeated , Primary Key constraint is added.
2. Domain Constraints : These constraints are added to ensure that data being added is within the range and type of the datatype of the column. For example to make sure that no value in a column named EmpID is > 50 , this constraint is used. This type of constraint is implemented using the Check constraint which makes sure that no value greater than 50 is added in the EmpID column.
3. Refrential Integrity Constraint : This type of constraint is added to make sure that data from a table is not deleted if any of its columns is having relation with another table in the database i.e. any other table is dependent on the parent table. This type of constraint isimplemented by the concept of Foreign Key Constraint. For ex : if a table named tbEmp is having EmpID as Primary Key and is referring to EmpID column (which acts as Foreign Key) of another table named tbDepartment , the Foreign Key Constraint makes sure that no data from parent table tbEmp is deleted until all the underlying values from tbDepartment are deleted.
4. User Defined Constraints : These are some rules defined by users which are not in the above





