<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-4570388358056942020</id><updated>2012-02-16T19:03:25.665+05:30</updated><title type='text'>Welcome to Microsoft World</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://deiva-apk.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4570388358056942020/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://deiva-apk.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Deiva</name><uri>http://www.blogger.com/profile/01579444991016554353</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://2.bp.blogspot.com/_yOUXlZCsLwo/SijGXeEKTcI/AAAAAAAAAC4/wZCfvpFCaTQ/S220/IMG_2074.JPG'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>26</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-4570388358056942020.post-7417847955334856594</id><published>2009-07-09T13:41:00.001+05:30</published><updated>2009-07-09T13:44:24.258+05:30</updated><title type='text'>Difference between Int32.Parse(), Convert.ToInt32 and Int32.TryParse()</title><content type='html'>&lt;span style="font-weight:bold;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Int32.Parse Method&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;-Converts the string representation of a number to its 32-bit signed integer equivalent.&lt;br /&gt;-When s is a null reference, it will throw ArgumentNullException.&lt;br /&gt;-If s is other than integer value, it will throw FormatException.&lt;br /&gt;-When s represents a number out of range, it will throw OverflowException.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Example Program&lt;/span&gt;&lt;br /&gt;int quantity;&lt;br /&gt;try&lt;br /&gt;{&lt;br /&gt; quantity = int.Parse(txtQuantity.Text);&lt;br /&gt;}&lt;br /&gt;catch (FormatException)&lt;br /&gt;{&lt;br /&gt; quantity = 0;&lt;br /&gt;}&lt;br /&gt;catch (OverflowException)&lt;br /&gt;{&lt;br /&gt; quantity = 0;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Convert.ToInt32(string)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;-Converts the specified string representation of 32-bit signed integer equivalent. This calls in turn Int32.Parse () method.&lt;br /&gt;-When s is a null reference, it will return 0 rather than throw ArgumentNullException.&lt;br /&gt;-If s is other than integer value, it will throw FormatException.&lt;br /&gt;-When s represents a number out of range, it will throw OverflowException.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Int32.TryParse Method&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;-Converts the specified string representation of 32-bit signed integer equivalent to out variable, and returns true if it is parsed successfully, false otherwise.&lt;br /&gt;-When s is a null reference, it will return 0.&lt;br /&gt;-If s is other than an integer value, the out variable will have 0.&lt;br /&gt;-When s represents a number out of range, the out variable will have 0. &lt;br /&gt;&lt;br /&gt;int quantity;&lt;br /&gt;if (int.TryParse(txtQuantity.Text, out quantity) == false)&lt;br /&gt;{&lt;br /&gt; quantity = 0;   &lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4570388358056942020-7417847955334856594?l=deiva-apk.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://deiva-apk.blogspot.com/feeds/7417847955334856594/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4570388358056942020&amp;postID=7417847955334856594' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4570388358056942020/posts/default/7417847955334856594'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4570388358056942020/posts/default/7417847955334856594'/><link rel='alternate' type='text/html' href='http://deiva-apk.blogspot.com/2009/07/difference-between-int32parse.html' title='Difference between Int32.Parse(), Convert.ToInt32 and Int32.TryParse()'/><author><name>Deiva</name><uri>http://www.blogger.com/profile/01579444991016554353</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://2.bp.blogspot.com/_yOUXlZCsLwo/SijGXeEKTcI/AAAAAAAAAC4/wZCfvpFCaTQ/S220/IMG_2074.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4570388358056942020.post-667993809505078050</id><published>2009-06-23T11:16:00.002+05:30</published><updated>2009-06-23T11:34:00.344+05:30</updated><title type='text'>T-SQL Queries Interview Questions</title><content type='html'>&lt;span style="font-weight:bold;"&gt;1. 2 tables&lt;/span&gt; &lt;span style="font-weight:bold;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Employee&lt;/span&gt; &lt;br /&gt;empid&lt;br /&gt;empname&lt;br /&gt;salary&lt;br /&gt;mgrid&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Phone&lt;/span&gt;&lt;br /&gt;empid&lt;br /&gt;phnumber&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;2. Select all employees who doesn't have phone?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;SELECT empname FROM Employee&lt;br /&gt;WHERE (empid NOT IN (SELECT DISTINCT empid FROM phone))&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;3. Select the employee names who is having more than one phone numbers.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;SELECT empname FROM employee&lt;br /&gt;WHERE (empid IN (SELECT empid FROM phone GROUP BY empid HAVING COUNT(empid) &gt; 1))&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;4. Select the details of 3 max salaried employees from employee table.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;SELECT TOP 3 empid, salary FROM employee&lt;br /&gt;ORDER BY salary DESC&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;5. Display all managers from the table. (manager id is same as emp id)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;SELECT empname FROM employee &lt;br /&gt;WHERE (empid IN (SELECT DISTINCT mgrid FROM employee))&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;6. Write a Select statement to list the Employee Name, Manager Name under a particular manager?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;SELECT e1.empname AS EmpName, e2.empname AS ManagerName&lt;br /&gt;FROM Employee e1 INNER JOIN Employee e2 &lt;br /&gt;ON e1.mgrid = e2.empid&lt;br /&gt;ORDER BY e2.mgrid&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;7. 2 tables emp and phone.&lt;/span&gt;&lt;br /&gt;emp fields are - empid, name&lt;br /&gt;Ph fields are - empid, ph (office, mobile, home). Select all employees who doesn't have any ph nos.&lt;br /&gt;&lt;br /&gt;SELECT * FROM employee &lt;br /&gt;LEFT OUTER JOIN phone &lt;br /&gt;ON employee.empid = phone.empid&lt;br /&gt;WHERE (phone.office IS NULL OR phone.office = ' ')&lt;br /&gt;AND (phone.mobile IS NULL OR phone.mobile = ' ')&lt;br /&gt;AND (phone.home IS NULL OR phone.home = ' ')&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;8. Find employee who is living in more than one city.&lt;/span&gt;&lt;br /&gt;Two Tables:&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;employee&lt;/span&gt;&lt;br /&gt;Emp &lt;br /&gt;Empid&lt;br /&gt;empName&lt;br /&gt;Salary&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;City&lt;br /&gt;&lt;/span&gt;Empid&lt;br /&gt;City&lt;br /&gt;&lt;br /&gt;9. &lt;br /&gt;SELECT empname, fname, lname&lt;br /&gt;FROM employee&lt;br /&gt;WHERE (empid IN (SELECT empid FROM city GROUP BY empid HAVING COUNT(empid) &gt; 1))&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;&lt;br /&gt;10. Find all employees who is living in the same city. (table is same as above)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;SELECT fname FROM employee&lt;br /&gt;WHERE (empid IN (SELECT empid FROM city a WHERE city IN (SELECT city FROM city b GROUP BY city&lt;br /&gt;HAVING COUNT(city) &gt; 1)))&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;&lt;br /&gt;11. There is a table named MovieTable with three columns - moviename,&lt;br /&gt;person and role. Write a query which gets the movie details where Mr.&lt;br /&gt;Amitabh and Mr. Vinod acted and their role is actor.&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;SELECT DISTINCT m1.moviename FROM MovieTable m1 &lt;br /&gt;INNER JOIN MovieTable m2 &lt;br /&gt;ON m1.moviename = m2.moviename&lt;br /&gt;WHERE (m1.person = 'amitabh' AND m2.person = 'vinod' OR m2.person = 'amitabh' AND m1.person = 'vinod') AND (m1.role = 'actor') AND (m2.role = 'actor') &lt;br /&gt;ORDER BY m1.moviename&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;&lt;br /&gt;12. There are two employee tables named emp1 and emp2. Both contains&lt;br /&gt;same structure (salary details). But Emp2 salary details are incorrect&lt;br /&gt;and emp1 salary details are correct. So, write a query which corrects&lt;br /&gt;salary details of the table emp2&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;update a set a.sal=b.sal from emp1 a, emp2 b where a.empid=b.empid&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;13.Given a Table named “Students” which contains studentid, subjectid and&lt;br /&gt;marks. Where there are 10 subjects and 50 students. Write a Query to&lt;br /&gt;find out the Maximum marks obtained in each subject.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;14.In this same tables now write a SQL Query to get the studentid also to&lt;br /&gt;combine with previous results.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;15. Three tables – student , course, marks – how do go at finding name of&lt;br /&gt;the students who got max marks in the diff courses.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;SELECT student.name, course.name AS coursename, marks.sid,&lt;br /&gt;marks.mark FROM marks &lt;br /&gt;INNER JOIN student &lt;br /&gt;ON marks.sid = student.sid &lt;br /&gt;INNER JOIN course &lt;br /&gt;ON marks.cid = course.cid WHERE (marks.mark = (SELECT MAX(Mark)FROM Marks MaxMark&lt;br /&gt;WHERE MaxMark.cID = Marks.cID))&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;&lt;br /&gt;16. There is a table day_temp which has three columns dayid, day and&lt;br /&gt;temperature. How do I write a query to get the difference of&lt;br /&gt;temperature among each other for seven days of a week?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;SELECT a.dayid, a.dday, a.tempe, a.tempe - b.tempe AS Difference FROM day_temp &lt;br /&gt;a INNER JOIN day_temp b &lt;br /&gt;ON a.dayid = b.dayid + 1&lt;br /&gt;&lt;br /&gt;OR&lt;br /&gt;&lt;br /&gt;Select a.day, a.degree-b.degree from temperature a, temperature b&lt;br /&gt;where a.id=b.id+1&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;&lt;br /&gt;17. There is a table which contains the names like this. a1, a2, a3, a3, a4, a1, a1, a2 and their salaries. Write a query to get grand total salary, and total salaries of individual employees in one query.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;SELECT empid, SUM(salary) AS salary&lt;br /&gt;FROM employee&lt;br /&gt;GROUP BY empid WITH ROLLUP&lt;br /&gt;ORDER BY empid&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;&lt;br /&gt;18. How to know how many tables contains empno as a column in a database?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;SELECT COUNT(*) AS Counter&lt;br /&gt;FROM syscolumns&lt;br /&gt;WHERE (name = 'empno')&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;&lt;br /&gt;19. Find duplicate rows in a table? OR I have a table with one column which has many records which are not distinct. I need to find the distinct values from that column and number of times it’s repeated&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;SELECT sid, mark, COUNT(*) AS Counter&lt;br /&gt;FROM marks&lt;br /&gt;GROUP BY sid, mark&lt;br /&gt;HAVING (COUNT(*) &gt; 1)&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;&lt;br /&gt;20. How to delete the rows which are duplicate (don’t delete both duplicate records).&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;SET ROWCOUNT 1&lt;br /&gt;DELETE yourtable FROM yourtable a&lt;br /&gt;WHERE (SELECT COUNT(*) FROM yourtable b WHERE b.name1 = a.name1 AND b.age1 = a.age1) &gt; 1&lt;br /&gt;WHILE @@rowcount &gt; 0&lt;br /&gt;&lt;br /&gt;DELETE yourtable FROM yourtable a WHERE (SELECT COUNT(*) FROM yourtable b WHERE b.name1 = a.name1 AND b.age1 = a.age1) &gt; 1&lt;br /&gt;SET ROWCOUNT 0&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;21. How to find 6th highest salary&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;SELECT TOP 1 salary FROM (SELECT DISTINCT TOP 6 salary FROM employee ORDER BY salary DESC) a&lt;br /&gt;ORDER BY salary&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;&lt;br /&gt;22. Find top salary among two tables&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;SELECT TOP 1 sal FROM (SELECT MAX(sal) AS sal FROM sal1 &lt;br /&gt;UNION&lt;br /&gt;SELECT MAX(sal) AS sal FROM sal2) a&lt;br /&gt;ORDER BY sal DESC&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;&lt;br /&gt;23. Write a query to convert all the letters in a word to upper case &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;SELECT UPPER('test')&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;&lt;br /&gt;24. Write a query to round up the values of a number. For example even if the user enters 7.1 it should be rounded up to 8.&lt;/span&gt; &lt;br /&gt;&lt;br /&gt;SELECT CEILING (7.1)&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;&lt;br /&gt;25. Write a SQL Query to find first day of month?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;SELECT DATENAME(dw, DATEADD(dd, - DATEPART(dd, GETDATE()) + 1,GETDATE())) AS FirstDay&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Datepart    Abbreviations&lt;/span&gt;&lt;br /&gt;year        yy, yyyy&lt;br /&gt;quarter     qq, q&lt;br /&gt;month       mm, m&lt;br /&gt;dayofyear   dy, y&lt;br /&gt;day         dd, d&lt;br /&gt;week        wk, ww&lt;br /&gt;weekday     dw&lt;br /&gt;hour        hh&lt;br /&gt;minute      mi, n&lt;br /&gt;second      ss, s&lt;br /&gt;millisecond ms&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;&lt;br /&gt;26. Table A contains column1 which is primary key and has 2 values (1, 2) and Table B contains column1 which is primary key and has 2 values (2, 3). Write a query which returns the values that are not common for the tables and the query should return one column with 2 records.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;SELECT tbla.a FROM tbla, tblb&lt;br /&gt;WHERE tbla.a &lt;&gt; (SELECT tblb.a FROM tbla, tblb WHERE tbla.a = tblb.a)&lt;br /&gt;UNION&lt;br /&gt;SELECT tblb.a FROM tbla, tblb&lt;br /&gt;WHERE tblb.a &lt;&gt; (SELECT tbla.a FROM tbla, tblb WHERE tbla.a = tblb.a)&lt;br /&gt;&lt;br /&gt;OR (better approach)&lt;br /&gt;&lt;br /&gt;SELECT a FROM tbla&lt;br /&gt;WHERE a NOT IN (SELECT a FROM tblb)&lt;br /&gt;UNION ALL&lt;br /&gt;SELECT a FROM tblb &lt;br /&gt;WHERE a NOT IN (SELECT a FROM tbla)&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;&lt;br /&gt;27. There are 3 tables Titles, Authors and Title-Authors (check PUBS db).&lt;br /&gt;Write the query to get the author name and the number of books written by that author, the result should start from the author who has written the maximum number of books and end with the author who has written the minimum number of books.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;SELECT authors.au_lname, COUNT(*) AS BooksCount FROM authors INNER JOIN&lt;br /&gt;titleauthor ON authors.au_id = titleauthor.au_id INNER JOIN&lt;br /&gt;titles ON titles.title_id = titleauthor.title_id&lt;br /&gt;GROUP BY authors.au_lname&lt;br /&gt;ORDER BY BooksCount DESC&lt;br /&gt;&lt;br /&gt;28. UPDATE emp_master &lt;br /&gt;SET emp_sal = CASE WHEN emp_sal &gt; 0 AND emp_sal &lt;= 20000 THEN (emp_sal * 1.01) WHEN emp_sal &gt; 20000 THEN (emp_sal * 1.02)&lt;br /&gt;END&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;29. List all products with total quantity ordered, if quantity ordered is null show it as 0.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;SELECT name, CASE WHEN SUM(qty) IS NULL THEN 0 WHEN SUM(qty) &gt; 0 THEN SUM(qty) END AS tot FROM [order] RIGHT OUTER JOIN product &lt;br /&gt;ON  [order].prodid = product.prodid&lt;br /&gt;GROUP BY name&lt;br /&gt;&lt;br /&gt;Result:&lt;br /&gt;coke 60&lt;br /&gt;mirinda 0&lt;br /&gt;pepsi 10&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;30.ANY, SOME, or ALL?&lt;/span&gt;&lt;br /&gt;ALL means greater than every value--in other words, greater than the&lt;br /&gt;maximum value. For example, &gt;ALL (1, 2, 3) means greater than 3. &lt;br /&gt;ANY means greater than at least one value, that is, greater than the minimum. So &gt;ANY (1, 2, 3) means greater than 1. &lt;br /&gt;SOME is an SQL-92 standard equivalent for ANY.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;31. IN &amp; =&lt;/span&gt; (difference in correlated sub query)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4570388358056942020-667993809505078050?l=deiva-apk.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://deiva-apk.blogspot.com/feeds/667993809505078050/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4570388358056942020&amp;postID=667993809505078050' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4570388358056942020/posts/default/667993809505078050'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4570388358056942020/posts/default/667993809505078050'/><link rel='alternate' type='text/html' href='http://deiva-apk.blogspot.com/2009/06/t-sql-queries-interview-questions.html' title='T-SQL Queries Interview Questions'/><author><name>Deiva</name><uri>http://www.blogger.com/profile/01579444991016554353</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://2.bp.blogspot.com/_yOUXlZCsLwo/SijGXeEKTcI/AAAAAAAAAC4/wZCfvpFCaTQ/S220/IMG_2074.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4570388358056942020.post-7905868314590578954</id><published>2009-06-23T10:56:00.002+05:30</published><updated>2009-06-23T11:15:42.841+05:30</updated><title type='text'>Interview Questions C#</title><content type='html'>&lt;span style="font-weight:bold;"&gt;1. What’s the implicit name of the parameter that gets passed into the class’ set method? &lt;/span&gt;&lt;br /&gt;Value, and its datatype depends on whatever variable we’re changing.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;2. How do you inherit from a class in C#? &lt;/span&gt;&lt;br /&gt;Place a colon and then the name of the base class. Notice that it’s double colon in C++. &lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;3. Does C# support multiple inheritance? &lt;/span&gt;&lt;br /&gt;No, use interfaces instead.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;4. When you inherit a protected class-level variable, who is it available to? &lt;/span&gt;&lt;br /&gt;Classes in the same namespace.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;5. Are private class-level variables inherited? &lt;/span&gt;&lt;br /&gt;Yes, but they are not accessible, so looking at it you can honestly say that they are not inherited. But they are.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;6. Describe the accessibility modifier protected internal.&lt;/span&gt; &lt;br /&gt;It’s available to derived classes and classes within the same Assembly (and naturally&lt;br /&gt;from the base class it’s declared in).&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;7. C# provides a default constructor for me. I write a constructor that takes a string as a parameter, but want to keep the no parameter one. How many constructors should I write? &lt;/span&gt;&lt;br /&gt;Two. Once you write at least one constructor, C# cancels the freebie constructor,and now you have to write one yourself, even if there’s no implementation in it.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;8. What’s the top .NET class that everything is derived from?&lt;/span&gt;&lt;br /&gt;System.Object.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;9. How’s method overriding different from overloading? &lt;/span&gt;&lt;br /&gt;When overriding, you change the method behavior for a derived class. Overloading simply involves having a method with the same name within the class.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;10.What does the keyword virtual mean in the method definition?&lt;/span&gt;&lt;br /&gt;The method can be over-ridden.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;11. Can you declare the override method static while the original  method is non-static? &lt;/span&gt;&lt;br /&gt;No, you can’t, the signature of the virtual method must remain the same, only the keyword virtual is changed to keyword override.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;12. Can you override private virtual methods? &lt;/span&gt;&lt;br /&gt;No, moreover, you cannot access private methods in inherited classes, have to be protected in the base class to allow any sort of access.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;13. Can you prevent your class from being inherited and becoming a base class for some other classes? &lt;/span&gt;&lt;br /&gt;Yes, that’s what keyword sealed in the class definition is for. The developer trying to derive from your class will get a message: cannot inherit from Sealed class&lt;br /&gt;WhateverBaseClassName. It’s the same concept as final class in Java.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;14. Can you allow class to be inherited, but prevent the method from being over-ridden? &lt;/span&gt;&lt;br /&gt;Yes, just leave the class public and make the method sealed.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;15.What’s an abstract class?&lt;/span&gt; &lt;br /&gt;A class that cannot be instantiated. A concept in C++ known as pure virtual method. A class that must be inherited and have the methods over-ridden. Essentially, it’s a blueprint for a class without any implementation.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;16.When do you absolutely have to declare a class as abstract (as opposed to free-willed educated choice or decision based on UML diagram)? &lt;/span&gt;&lt;br /&gt;When at least one of the methods in the class is abstract. When the class itself is inherited from an abstract class, but not all base abstract methods have been over-ridden.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;17.What’s an interface class? &lt;/span&gt;&lt;br /&gt;It’s an abstract class with public abstract methods all of which must be implemented in the inherited classes.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;18.Why can’t you specify the accessibility modifier for methods inside the interface? &lt;/span&gt;&lt;br /&gt;They all must be public. Therefore, to prevent you from getting the false impression that you have any freedom of choice, you are not allowed to specify any accessibility, it’s public by default.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;19. Can you inherit multiple interfaces?&lt;/span&gt;&lt;br /&gt;Yes, why not.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;20. And if they have conflicting method names? &lt;/span&gt;&lt;br /&gt;It’s up to you to implement the method inside your own class, so implementation is left entirely up to you. This might cause a problem on a higher-level scale if similarly named methods from different interfaces expect different data, but as far as compiler cares you’re okay.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;21.What’s the difference between an interface and abstract class?&lt;/span&gt; &lt;br /&gt;In the interface all methods must be abstract; in the abstract class some methods can be concrete. In the interface no accessibility modifiers are allowed, which is ok in abstract classes.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;22. How can you overload a method? &lt;/span&gt;&lt;br /&gt;Different parameter data types, different number of parameters, different order of parameters.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;23. If a base class has a bunch of overloaded constructors, and an inherited class has another bunch of overloaded constructors, can you enforce a call from an inherited constructor to an arbitrary base constructor? &lt;/span&gt;&lt;br /&gt;Yes, just place a colon, and then keyword base (parameter list to invoke the appropriate constructor) in the&lt;br /&gt;overloaded constructor definition inside the inherited class. &lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;24.What’s the difference between System.String and System.StringBuilder classes?&lt;/span&gt; System.String is immutable; System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;25.What’s the advantage of using System.Text.StringBuilder over System.String?&lt;/span&gt; StringBuilder is more efficient in the cases, where a lot of manipulation is done to the text. Strings are immutable, so each time it’s being operated on, a new instance is created.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;26. Can you store multiple data types in System.Array? &lt;/span&gt;&lt;br /&gt;No.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;27.What’s the difference between the System.Array.CopyTo() and System.Array.Clone()?&lt;/span&gt; The first one performs a deep copy of the array, the second one is shallow.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;28. How can you sort the elements of the array in descending order?&lt;/span&gt;&lt;br /&gt;By calling Sort() and then Reverse() methods.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;29.What’s the .NET datatype that allows the retrieval of data by a unique key? &lt;/span&gt;&lt;br /&gt;HashTable.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;30.What’s class SortedList underneath? &lt;/span&gt;&lt;br /&gt;A sorted HashTable.&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;&lt;br /&gt;31. Will finally block get executed if the exception had not occurred?&lt;/span&gt;&lt;br /&gt;Yes.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;32.What’s the C# equivalent of C++ catch (…), which was a catchall statement for any possible exception? &lt;/span&gt;&lt;br /&gt;A catch block that catches the exception of type System.Exception. You can also omit the parameter data type in this case and just write catch {}. &lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;33. Can multiple catch blocks be executed? &lt;/span&gt;&lt;br /&gt;No, once the proper catch code fires off, the control is transferred to the finally block (if there are any), and then whatever follows the finally block.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;34.Why is it a bad idea to throw your own exceptions? &lt;/span&gt;&lt;br /&gt;Well, if at that point you know that an error has occurred, then why not write the proper code to handle that error instead of passing a new Exception object to the catch block? Throwing your own exceptions signifies some design flaws in the project.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;35.What’s a delegate? &lt;/span&gt;&lt;br /&gt;A delegate object encapsulates a reference to a method. In C++ they were referred to as function pointers.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;36.What’s a multicast delegate? &lt;/span&gt;&lt;br /&gt;It’s a delegate that points to and eventually fires off several methods.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;37. How’s the DLL Hell problem solved in .NET?&lt;/span&gt; &lt;br /&gt;Assembly versioning allows the application to specify not only the library it needs to run (which was available under Win32), but also the version of the assembly.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;38.What are the ways to deploy an assembly? &lt;/span&gt;&lt;br /&gt;An MSI installer, a CAB archive, and XCOPY command.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;39.What’s a satellite assembly? &lt;/span&gt;&lt;br /&gt;When you write a multilingual or multicultural application in .NET, and want to distribute the core applicationseparately from the localized modules, the localized assemblies that&lt;br /&gt;modify the core application are called satellite assemblies.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;40.What namespaces are necessary to create a localized application? &lt;/span&gt;System.Globalization, System.Resources.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;41.What’s the difference between // comments, /* */ comments and /// comments? &lt;/span&gt;&lt;br /&gt;Single-line, multi-line and XML documentation comments.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;42. How do you generate documentation from the C# file commented properly with a command-line compiler? &lt;/span&gt;&lt;br /&gt;Compile it with a /doc switch.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;43.What’s the difference between &lt;c&gt; and &lt;code&gt; XML documentation tag? &lt;/span&gt;&lt;br /&gt;Single line code example and multiple-line code example.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;44. Is XML case-sensitive? &lt;/span&gt;&lt;br /&gt;Yes, so &lt;Student&gt; and &lt;student&gt; are different elements.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;45.What debugging tools come with the .NET SDK?&lt;/span&gt; &lt;br /&gt;CorDBG – command-line debugger, and DbgCLR – graphic debugger. Visual Studio .NET uses the DbgCLR. To use CorDbg, you must compile the original C# file using the /debug switch.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;46.What does the This window show in the debugger? &lt;/span&gt;&lt;br /&gt;It points to the object that’s pointed to by this reference. Object’s instance data is shown.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;47.What does assert() do? &lt;/span&gt;&lt;br /&gt;In debug compilation, assert takes in a Boolean condition as a parameter, and shows the error dialog if the condition is false. The program proceeds without any interruption if the condition is true.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;48.What’s the difference between the Debug class and Trace class?&lt;/span&gt;&lt;br /&gt;Documentation looks the same. Use Debug class for debug builds, use Trace class for both debug and release builds.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;49.Why are there five tracing levels in System.Diagnostics.TraceSwitcher? &lt;/span&gt;&lt;br /&gt;The tracing dumps can be quite verbose and for some applications that are constantly running you run the risk of overloading the machine and the hard drive there. Five levels range from None to Verbose, allowing to fine-tune the tracing activities.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;50.Where is the output of TextWriterTraceListener redirected? &lt;/span&gt;&lt;br /&gt;To the Console or a text file depending on the parameter passed to the constructor.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;51. How do you debug an ASP.NET Web application? &lt;/span&gt;&lt;br /&gt;Attach the aspnet_wp.exe process to the DbgClr debugger.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;52.What are three test cases you should go through in unit testing?&lt;/span&gt;&lt;br /&gt;Positive test cases (correct data, correct output), negative test cases (broken or missing data, proper handling), exception test cases (exceptions are thrown and caught properly).&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;53. Can you change the value of a variable while debugging a C# application? &lt;/span&gt;&lt;br /&gt;Yes, if you are debugging via Visual Studio.NET, just go to Immediate window.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;54. Explain the three services model (three-tier application).&lt;/span&gt;&lt;br /&gt;Presentation (UI), business (logic and underlying code) and data (from storage or other sources).&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;55.What are advantages and disadvantages of Microsoft-provided data provider classes in ADO.NET? &lt;/span&gt;&lt;br /&gt;SQLServer.NET data provider is high-speed and robust, but requires SQL Server license purchased from Microsoft. OLE-DB.NET is universal for accessing other sources, like Oracle, DB2, Microsoft Access and Informix, but it’s a .NET layer on top of OLE layer, so not the fastest thing in the world. ODBC.NET is a deprecated layer provided for backward compatibility to ODBC engines.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;56.What’s the role of the DataReader class in ADO.NET connections?&lt;/span&gt;&lt;br /&gt;It returns a read-only dataset from the data source when the command is executed.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;57.What is the wildcard character in SQL?&lt;/span&gt; &lt;br /&gt;Let’s say you want to query database with LIKE for all employees whose name starts&lt;br /&gt;with La. The wildcard character is %, the proper query with LIKE would involve ‘La%’.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;58. Explain ACID rule of thumb for transactions.&lt;/span&gt; &lt;br /&gt;Transaction must be Atomic (it is one unit of work and does not dependent on previous and following transactions), Consistent (data is either committed or roll back, no “in-between” case where something has been updated and something hasn’t), Isolated (no transaction sees the intermediate results of the current transaction), Durable (the values persist if the data had been committed even if the system crashes right after).&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;59.What connections does Microsoft SQL Server support? &lt;/span&gt;&lt;br /&gt;Windows Authentication (via Active Directory) and SQL Server authentication (via&lt;br /&gt;Microsoft SQL Server username and passwords).&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;60.Which one is trusted and which one is untrusted? &lt;/span&gt;&lt;br /&gt;Windows Authentication is trusted because the username and password are checked with the Active Directory, the SQL Server authentication is untrusted, since SQL Server is the only verifier participating in the transaction.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;61.Why would you use untrusted verificaion? &lt;/span&gt;&lt;br /&gt;Web Services might use it, as well as non-Windows applications.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;62.What does the parameter Initial Catalog define inside Connection String? &lt;/span&gt;&lt;br /&gt;The database name to connect to.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;63.What’s the data provider name to connect to Access database?&lt;/span&gt;&lt;br /&gt;Microsoft.Access.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;64.What does Dispose method do with the connection object?&lt;/span&gt;&lt;br /&gt;Deletes it from the memory.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;65.What is a pre-requisite for connection pooling? &lt;/span&gt;&lt;br /&gt;Multiple processes must agree that they will share the same connection, where every&lt;br /&gt;parameter is the same, including the security settings.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4570388358056942020-7905868314590578954?l=deiva-apk.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://deiva-apk.blogspot.com/feeds/7905868314590578954/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4570388358056942020&amp;postID=7905868314590578954' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4570388358056942020/posts/default/7905868314590578954'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4570388358056942020/posts/default/7905868314590578954'/><link rel='alternate' type='text/html' href='http://deiva-apk.blogspot.com/2009/06/interview-questions-c.html' title='Interview Questions C#'/><author><name>Deiva</name><uri>http://www.blogger.com/profile/01579444991016554353</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://2.bp.blogspot.com/_yOUXlZCsLwo/SijGXeEKTcI/AAAAAAAAAC4/wZCfvpFCaTQ/S220/IMG_2074.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4570388358056942020.post-162553386106904981</id><published>2009-06-05T12:39:00.000+05:30</published><updated>2009-06-05T12:41:03.540+05:30</updated><title type='text'>Sql Interview Questions</title><content type='html'>What is RDBMS?&lt;br /&gt;&lt;br /&gt;Relational Data Base Management Systems (RDBMS) are database management systems that maintain data records and indices in tables. Relationships may be created and maintained across and among the data and tables. In a relational database, relationships between data items are expressed by means of tables. Interdependencies among these tables are expressed by data values rather than by pointers. This allows a high degree of data independence. An RDBMS has the capability to recombine the data items from different files, providing powerful tools for data usage. &lt;br /&gt;&lt;br /&gt;What is normalization?&lt;br /&gt;&lt;br /&gt;Database normalization, is a data design and organization process, applied to data structures based on rules that helps build relational databases. In relational database design, the process of organizing data is to minimize redundancy. Normalization usually involves dividing a database into two or more tables and defining relationships between the tables. The objective is to isolate data so that additions, deletions, and modifications of a field can be made in just one table and then propagated through the rest of the database via the defined relationships.&lt;br /&gt;&lt;br /&gt;What are different normalization forms?&lt;br /&gt;&lt;br /&gt;1NF: Eliminate Repeating Groups&lt;br /&gt;&lt;br /&gt;Make a separate table for each set of related attributes, and give each table a primary key. Each field contains at most one value from its attribute domain.&lt;br /&gt;&lt;br /&gt;2NF: Eliminate Redundant Data&lt;br /&gt;&lt;br /&gt;If an attribute depends on only part of a multi-valued key, remove it to a separate table.&lt;br /&gt;&lt;br /&gt;3NF: Eliminate Columns Not Dependent On Key&lt;br /&gt;&lt;br /&gt;If attributes do not contribute to a description of the key, remove them to a separate table. All attributes must be directly dependent on the primary key&lt;br /&gt;&lt;br /&gt;BCNF: Boyce-Codd Normal Form&lt;br /&gt;&lt;br /&gt;If there are non-trivial dependencies between candidate key attributes, separate them out into distinct tables.&lt;br /&gt;&lt;br /&gt;4NF: Isolate Independent Multiple Relationships&lt;br /&gt;&lt;br /&gt;No table may contain two or more 1:n or n:m relationships that are not directly related.&lt;br /&gt;&lt;br /&gt;5NF: Isolate Semantically Related Multiple Relationships&lt;br /&gt;&lt;br /&gt;There may be practical constrains on information that justify separating logically related many-to-many relationships.&lt;br /&gt;&lt;br /&gt;ONF: Optimal Normal Form&lt;br /&gt;&lt;br /&gt;A model limited to only simple (elemental) facts, as expressed in Object Role Model notation.&lt;br /&gt;&lt;br /&gt;DKNF: Domain-Key Normal Form&lt;br /&gt;&lt;br /&gt;A model free from all modification anomalies.&lt;br /&gt;&lt;br /&gt;Remember, these normalization guidelines are cumulative. For a database to be in 3NF, it must first fulfill all the criteria of a 2NF and 1NF database.&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;What is Stored Procedure?&lt;br /&gt;&lt;br /&gt;A stored procedure is a named group of SQL statements that have been previously created and stored in the server database. Stored procedures accept input parameters so that a single procedure can be used over the network by several clients using different input data. And when the procedure is modified, all clients automatically get the new version. Stored procedures reduce network traffic and improve performance. Stored procedures can be used to help ensure the integrity of the database.&lt;br /&gt;&lt;br /&gt;e.g. sp_helpdb, sp_renamedb, sp_depends etc.&lt;br /&gt;&lt;br /&gt;What is Trigger?&lt;br /&gt;&lt;br /&gt;A trigger is a SQL procedure that initiates an action when an event (INSERT, DELETE or UPDATE) occurs. Triggers are stored in and managed by the DBMS.Triggers are used to maintain the referential integrity of data by changing the data in a systematic fashion. A trigger cannot be called or executed; the DBMS automatically fires the trigger as a result of a data modification to the associated table. Triggers can be viewed as similar to stored procedures in that both consist of procedural logic that is stored at the database level. Stored procedures, however, are not event-drive and are not attached to a specific table as triggers are. Stored procedures are explicitly executed by invoking a CALL to the procedure while triggers are implicitly executed. In addition, triggers can also execute stored procedures.&lt;br /&gt;Nested Trigger: A trigger can also contain INSERT, UPDATE and DELETE logic within itself, so when the trigger is fired because of data modification it can also cause another data modification, thereby firing another trigger. A trigger that contains data modification logic within itself is called a nested trigger.&lt;br /&gt;&lt;br /&gt;What is View?&lt;br /&gt;&lt;br /&gt;A simple view can be thought of as a subset of a table. It can be used for retrieving data, as well as updating or deleting rows. Rows updated or deleted in the view are updated or deleted in the table the view was created with. It should also be noted that as data in the original table changes, so does data in the view, as views are the way to look at part of the original table. The results of using a view are not permanently stored in the database. The data accessed through a view is actually constructed using standard T-SQL select command and can come from one to many different base tables or even other views.&lt;br /&gt;&lt;br /&gt;What is Index?&lt;br /&gt;&lt;br /&gt;An index is a physical structure containing pointers to the data. Indices are created in an existing table to locate rows more quickly and efficiently. It is possible to create an index on one or more columns of a table, and each index is given a name. The users cannot see the indexes, they are just used to speed up queries. Effective indexes are one of the best ways to improve performance in a database application. A table scan happens when there is no index available to help a query. In a table scan SQL Server examines every row in the table to satisfy the query results. Table scans are sometimes unavoidable, but on large tables, scans have a terrific impact on performance.&lt;br /&gt;&lt;br /&gt;Clustered indexes define the physical sorting of a database table’s rows in the storage media. For this reason, each database table may have only one clustered index.&lt;br /&gt;Non-clustered indexes are created outside of the database table and contain a sorted list of references to the table itself.&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;What is the difference between clustered and a non-clustered index?&lt;br /&gt;A clustered index is a special type of index that reorders the way records in the table are physically stored. Therefore table can have only one clustered index. The leaf nodes of a clustered index contain the data pages.&lt;br /&gt;&lt;br /&gt;A nonclustered index is a special type of index in which the logical order of the index does not match the physical stored order of the rows on disk. The leaf node of a nonclustered index does not consist of the data pages. Instead, the leaf nodes contain index rows.&lt;br /&gt;&lt;br /&gt;What are the different index configurations a table can have?&lt;br /&gt;A table can have one of the following index configurations:&lt;br /&gt;&lt;br /&gt;No indexes&lt;br /&gt;A clustered index&lt;br /&gt;A clustered index and many nonclustered indexes&lt;br /&gt;A nonclustered index&lt;br /&gt;Many nonclustered indexes&lt;br /&gt;&lt;br /&gt;What is cursors?&lt;br /&gt;Cursor is a database object used by applications to manipulate data in a set on a row-by-row basis, instead of the typical SQL commands that operate on all the rows in the set at one time.&lt;br /&gt;&lt;br /&gt;In order to work with a cursor we need to perform some steps in the following order:&lt;br /&gt;&lt;br /&gt;Declare cursor&lt;br /&gt;Open cursor&lt;br /&gt;Fetch row from the cursor&lt;br /&gt;Process fetched row&lt;br /&gt;Close cursor&lt;br /&gt;Deallocate cursor&lt;br /&gt;&lt;br /&gt;What is the use of DBCC commands?&lt;br /&gt;DBCC stands for database consistency checker. We use these commands to check the consistency of the databases, i.e., maintenance, validation task and status checks.&lt;br /&gt;E.g. DBCC CHECKDB - Ensures that tables in the db and the indexes are correctly linked.&lt;br /&gt;DBCC CHECKALLOC - To check that all pages in a db are correctly allocated.&lt;br /&gt;DBCC CHECKFILEGROUP - Checks all tables file group for any damage.&lt;br /&gt;&lt;br /&gt;What is a Linked Server?&lt;br /&gt;Linked Servers is a concept in SQL Server by which we can add other SQL Server to a Group and query both the SQL Server dbs using T-SQL Statements. With a linked server, you can create very clean, easy to follow, SQL statements that allow remote data to be retrieved, joined and combined with local data.&lt;br /&gt;Storped Procedure sp_addlinkedserver, sp_addlinkedsrvlogin will be used add new Linked Server.&lt;br /&gt;&lt;br /&gt;What is Collation?&lt;br /&gt;Collation refers to a set of rules that determine how data is sorted and compared. Character data is sorted using rules that define the correct character sequence, with options for specifying case-sensitivity, accent marks, kana character types and character width.&lt;br /&gt;&lt;br /&gt;What are different type of Collation Sensitivity?&lt;br /&gt;Case sensitivity&lt;br /&gt;A and a, B and b, etc.&lt;br /&gt;&lt;br /&gt;Accent sensitivity&lt;br /&gt;a and á, o and ó, etc.&lt;br /&gt;&lt;br /&gt;Kana Sensitivity&lt;br /&gt;When Japanese kana characters Hiragana and Katakana are treated differently, it is called Kana sensitive.&lt;br /&gt;&lt;br /&gt;Width sensitivity&lt;br /&gt;When a single-byte character (half-width) and the same character when represented as a double-byte character (full-width) are treated differently then it is width sensitive.&lt;br /&gt;&lt;br /&gt;What’s the difference between a primary key and a unique key?&lt;br /&gt;Both primary key and unique enforce uniqueness of the column on which they are defined. But by default primary key creates a clustered index on the column, where are unique creates a nonclustered index by default. Another major difference is that, primary key doesn’t allow NULLs, but unique key allows one NULL only.&lt;br /&gt;&lt;br /&gt;How to implement one-to-one, one-to-many and many-to-many relationships while designing tables?&lt;br /&gt;One-to-One relationship can be implemented as a single table and rarely as two tables with primary and foreign key relationships.&lt;br /&gt;One-to-Many relationships are implemented by splitting the data into two tables with primary key and foreign key relationships.&lt;br /&gt;Many-to-Many relationships are implemented using a junction table with the keys from both the tables forming the composite primary key of the junction table.&lt;br /&gt;&lt;br /&gt;What is a NOLOCK?&lt;br /&gt;Using the NOLOCK query optimiser hint is generally considered good practice in order to improve concurrency on a busy system. When the NOLOCK hint is included in a SELECT statement, no locks are taken when data is read. The result is a Dirty Read, which means that another process could be updating the data at the exact time you are reading it. There are no guarantees that your query will retrieve the most recent data. The advantage to performance is that your reading of data will not block updates from taking place, and updates will not block your reading of data. SELECT statements take Shared (Read) locks. This means that multiple SELECT statements are allowed simultaneous access, but other processes are blocked from modifying the data. The updates will queue until all the reads have completed, and reads requested after the update will wait for the updates to complete. The result to your system is delay(blocking).&lt;br /&gt;&lt;br /&gt;What is difference between DELETE &amp; TRUNCATE commands?&lt;br /&gt;Delete command removes the rows from a table based on the condition that we provide with a WHERE clause. Truncate will actually remove all the rows from a table and there will be no data in the table after we run the truncate command.&lt;br /&gt;&lt;br /&gt;TRUNCATE&lt;br /&gt;TRUNCATE is faster and uses fewer system and transaction log resources than DELETE.&lt;br /&gt;TRUNCATE removes the data by deallocating the data pages used to store the table’s data, and only the page deallocations are recorded in the transaction log.&lt;br /&gt;TRUNCATE removes all rows from a table, but the table structure and its columns, constraints, indexes and so on remain. The counter used by an identity for new rows is reset to the seed for the column.&lt;br /&gt;You cannot use TRUNCATE TABLE on a table referenced by a FOREIGN KEY constraint.&lt;br /&gt;Because TRUNCATE TABLE is not logged, it cannot activate a trigger.&lt;br /&gt;TRUNCATE can not be Rolled back using logs.&lt;br /&gt;TRUNCATE is DDL Command.&lt;br /&gt;TRUNCATE Resets identity of the table.&lt;br /&gt;&lt;br /&gt;DELETE&lt;br /&gt;DELETE removes rows one at a time and records an entry in the transaction log for each deleted row.&lt;br /&gt;If you want to retain the identity counter, use DELETE instead. If you want to remove table definition and its data, use the DROP TABLE statement.&lt;br /&gt;DELETE Can be used with or without a WHERE clause&lt;br /&gt;DELETE Activates Triggers.&lt;br /&gt;DELETE Can be Rolled back using logs.&lt;br /&gt;DELETE is DML Command.&lt;br /&gt;DELETE does not reset identity of the table.&lt;br /&gt;&lt;br /&gt;Difference between Function and Stored Procedure?&lt;br /&gt;UDF can be used in the SQL statements anywhere in the WHERE/HAVING/SELECT section where as Stored procedures cannot be.&lt;br /&gt;UDFs that return tables can be treated as another rowset. This can be used in JOINs with other tables.&lt;br /&gt;Inline UDF’s can be though of as views that take parameters and can be used in JOINs and other Rowset operations.&lt;br /&gt;&lt;br /&gt;When is the use of UPDATE_STATISTICS command?&lt;br /&gt;This command is basically used when a large processing of data has occurred. If a large amount of deletions any modification or Bulk Copy into the tables has occurred, it has to update the indexes to take these changes into account. UPDATE_STATISTICS updates the indexes on these tables accordingly.&lt;br /&gt;&lt;br /&gt;What types of Joins are possible with Sql Server?&lt;br /&gt;Joins are used in queries to explain how different tables are related. Joins also let you select data from a table depending upon data from another table.&lt;br /&gt;Types of joins: INNER JOINs, OUTER JOINs, CROSS JOINs. OUTER JOINs are further classified as LEFT OUTER JOINS, RIGHT OUTER JOINS and FULL OUTER JOINS.&lt;br /&gt;&lt;br /&gt;What is the difference between a HAVING CLAUSE and a WHERE CLAUSE?&lt;br /&gt;Specifies a search condition for a group or an aggregate. HAVING can be used only with the SELECT statement. HAVING is typically used in a GROUP BY clause. When GROUP BY is not used, HAVING behaves like a WHERE clause. Having Clause is basically used only with the GROUP BY function in a query. WHERE Clause is applied to each row before they are part of the GROUP BY function in a query. HAVING criteria is applied after the the grouping of rows has occurred.&lt;br /&gt;&lt;br /&gt;What is sub-query? Explain properties of sub-query.&lt;br /&gt;Sub-queries are often referred to as sub-selects, as they allow a SELECT statement to be executed arbitrarily within the body of another SQL statement. A sub-query is executed by enclosing it in a set of parentheses. Sub-queries are generally used to return a single row as an atomic value, though they may be used to compare values against multiple rows with the IN keyword.&lt;br /&gt;&lt;br /&gt;A subquery is a SELECT statement that is nested within another T-SQL statement. A subquery SELECT statement if executed independently of the T-SQL statement, in which it is nested, will return a result set. Meaning a subquery SELECT statement can standalone and is not depended on the statement in which it is nested. A subquery SELECT statement can return any number of values, and can be found in, the column list of a SELECT statement, a FROM, GROUP BY, HAVING, and/or ORDER BY clauses of a T-SQL statement. A Subquery can also be used as a parameter to a function call. Basically a subquery can be used anywhere an expression can be used.&lt;br /&gt;&lt;br /&gt;Properties of Sub-Query&lt;br /&gt;A subquery must be enclosed in the parenthesis.&lt;br /&gt;A subquery must be put in the right hand of the comparison operator, and&lt;br /&gt;A subquery cannot contain a ORDER-BY clause.&lt;br /&gt;A query can contain more than one sub-queries.&lt;br /&gt;&lt;br /&gt;What are types of sub-queries?&lt;br /&gt;Single-row subquery, where the subquery returns only one row.&lt;br /&gt;Multiple-row subquery, where the subquery returns multiple rows,.and&lt;br /&gt;Multiple column subquery, where the subquery returns multiple columns.&lt;br /&gt;&lt;br /&gt;What is SQL Profiler?&lt;br /&gt;SQL Profiler is a graphical tool that allows system administrators to monitor events in an instance of Microsoft SQL Server. You can capture and save data about each event to a file or SQL Server table to analyze later. For example, you can monitor a production environment to see which stored procedures are hampering performance by executing too slowly.&lt;br /&gt;&lt;br /&gt;Use SQL Profiler to monitor only the events in which you are interested. If traces are becoming too large, you can filter them based on the information you want, so that only a subset of the event data is collected. Monitoring too many events adds overhead to the server and the monitoring process and can cause the trace file or trace table to grow very large, especially when the monitoring process takes place over a long period of time.&lt;br /&gt;&lt;br /&gt;What is User Defined Functions?&lt;br /&gt;User-Defined Functions allow to define its own T-SQL functions that can accept 0 or more parameters and return a single scalar data value or a table data type.&lt;br /&gt;&lt;br /&gt;What kind of User-Defined Functions can be created?&lt;br /&gt;There are three types of User-Defined functions in SQL Server 2000 and they are Scalar, Inline Table-Valued and Multi-statement Table-valued.&lt;br /&gt;&lt;br /&gt;Scalar User-Defined Function&lt;br /&gt;A Scalar user-defined function returns one of the scalar data types. Text, ntext, image and timestamp data types are not supported. These are the type of user-defined functions that most developers are used to in other programming languages. You pass in 0 to many parameters and you get a return value.&lt;br /&gt;&lt;br /&gt;Inline Table-Value User-Defined Function&lt;br /&gt;An Inline Table-Value user-defined function returns a table data type and is an exceptional alternative to a view as the user-defined function can pass parameters into a T-SQL select command and in essence provide us with a parameterized, non-updateable view of the underlying tables.&lt;br /&gt;&lt;br /&gt;Multi-statement Table-Value User-Defined Function&lt;br /&gt;A Multi-Statement Table-Value user-defined function returns a table and is also an exceptional alternative to a view as the function can support multiple T-SQL statements to build the final result where the view is limited to a single SELECT statement. Also, the ability to pass parameters into a T-SQL select command or a group of them gives us the capability to in essence create a parameterized, non-updateable view of the data in the underlying tables. Within the create function command you must define the table structure that is being returned. After creating this type of user-defined function, It can be used in the FROM clause of a T-SQL command unlike the behavior found when using a stored procedure which can also return record sets.&lt;br /&gt;&lt;br /&gt;Which TCP/IP port does SQL Server run on? How can it be changed?&lt;br /&gt;SQL Server runs on port 1433. It can be changed from the Network Utility TCP/IP properties –&gt; Port number.both on client and the server.&lt;br /&gt;&lt;br /&gt;What are the authentication modes in SQL Server? How can it be changed?&lt;br /&gt;Windows mode and mixed mode (SQL &amp; Windows).&lt;br /&gt;&lt;br /&gt;To change authentication mode in SQL Server click Start, Programs, Microsoft SQL Server and click SQL Enterprise Manager to run SQL Enterprise Manager from the Microsoft SQL Server program group. Select the server then from the Tools menu select SQL Server Configuration Properties, and choose the Security page.&lt;br /&gt;&lt;br /&gt;Where are SQL server users names and passwords are stored in sql server?&lt;br /&gt;They get stored in master db in the sysxlogins table.&lt;br /&gt;&lt;br /&gt;Which command using Query Analyzer will give you the version of SQL server and operating system?&lt;br /&gt;&lt;br /&gt;SELECT  SERVERPROPERTY('productversion'), SERVERPROPERTY ('productlevel'), &lt;br /&gt;&lt;br /&gt;What is SQL server agent?&lt;br /&gt;SQL Server agent plays an important role in the day-to-day tasks of a database administrator (DBA). It is often overlooked as one of the main tools for SQL Server management. Its purpose is to ease the implementation of tasks for the DBA, with its full-function scheduling engine, which allows you to schedule your own jobs and scripts.&lt;br /&gt;&lt;br /&gt;Can a stored procedure call itself or recursive stored procedure? How many level SP nesting possible?&lt;br /&gt;Yes. Because Transact-SQL supports recursion, you can write stored procedures that call themselves. Recursion can be defined as a method of problem solving wherein the solution is arrived at by repetitively applying it to subsets of the problem. A common application of recursive logic is to perform numeric computations that lend themselves to repetitive evaluation by the same processing steps. Stored procedures are nested when one stored procedure calls another or executes managed code by referencing a CLR routine, type, or aggregate. You can nest stored procedures and managed code references up to 32 levels.&lt;br /&gt;&lt;br /&gt;What is @@ERROR?&lt;br /&gt;The @@ERROR automatic variable returns the error code of the last Transact-SQL statement. If there was no error, @@ERROR returns zero. Because @@ERROR is reset after each Transact-SQL statement, it must be saved to a variable if it is needed to process it further after checking it.&lt;br /&gt;&lt;br /&gt;What is Raiseerror?&lt;br /&gt;Stored procedures report errors to client applications via the RAISERROR command. RAISERROR doesn’t change the flow of a procedure; it merely displays an error message, sets the @@ERROR automatic variable, and optionally writes the message to the SQL Server error log and the NT application event log.&lt;br /&gt;&lt;br /&gt;What is log shipping?&lt;br /&gt;Log shipping is the process of automating the backup of database and transaction log files on a production SQL server, and then restoring them onto a standby server. Enterprise Editions only supports log shipping. In log shipping the transactional log file from one server is automatically updated into the backup database on the other server. If one server fails, the other server will have the same db can be used this as the Disaster Recovery plan. The key feature of log shipping is that is will automatically backup transaction logs throughout the day and automatically restore them on the standby server at defined interval.&lt;br /&gt;&lt;br /&gt;What is the difference between a local and a global variable?&lt;br /&gt;A local temporary table exists only for the duration of a connection or, if defined inside a compound statement, for the duration of the compound statement.&lt;br /&gt;&lt;br /&gt;A global temporary table remains in the database permanently, but the rows exist only within a given connection. When connection are closed, the data in the global temporary table disappears. However, the table definition remains with the database for access when database is opened next time.&lt;br /&gt;&lt;br /&gt;What command do we use to rename a db?&lt;br /&gt;sp_renamedb ‘oldname’ , ‘newname’&lt;br /&gt;If someone is using db it will not accept sp_renmaedb. In that case first bring db to single user using sp_dboptions. Use sp_renamedb to rename database. Use sp_dboptions to bring database to multi user mode.&lt;br /&gt;&lt;br /&gt;What is sp_configure commands and set commands?&lt;br /&gt;Use sp_configure to display or change server-level settings. To change database-level settings, use ALTER DATABASE. To change settings that affect only the current user session, use the SET statement.&lt;br /&gt;&lt;br /&gt;What are the different types of replication? Explain.&lt;br /&gt;The SQL Server 2000-supported replication types are as follows:&lt;br /&gt;&lt;br /&gt;    * Transactional&lt;br /&gt;    * Snapshot&lt;br /&gt;    * Merge&lt;br /&gt;&lt;br /&gt;Snapshot replication distributes data exactly as it appears at a specific moment in time and does not monitor for updates to the data. Snapshot replication is best used as a method for replicating data that changes infrequently or where the most up-to-date values (low latency) are not a requirement. When synchronization occurs, the entire snapshot is generated and sent to Subscribers.&lt;br /&gt;&lt;br /&gt;Transactional replication, an initial snapshot of data is applied at Subscribers, and then when data modifications are made at the Publisher, the individual transactions are captured and propagated to Subscribers.&lt;br /&gt;&lt;br /&gt;Merge replication is the process of distributing data from Publisher to Subscribers, allowing the Publisher and Subscribers to make updates while connected or disconnected, and then merging the updates between sites when they are connected.&lt;br /&gt;&lt;br /&gt;What are the OS services that the SQL Server installation adds?&lt;br /&gt;MS SQL SERVER SERVICE, SQL AGENT SERVICE, DTC (Distribution transac co-ordinator)&lt;br /&gt;&lt;br /&gt;What are three SQL keywords used to change or set someone’s permissions?&lt;br /&gt;GRANT, DENY, and REVOKE.&lt;br /&gt;&lt;br /&gt;What does it mean to have quoted_identifier on? What are the implications of having it off?&lt;br /&gt;When SET QUOTED_IDENTIFIER is ON, identifiers can be delimited by double quotation marks, and literals must be delimited by single quotation marks. When SET QUOTED_IDENTIFIER is OFF, identifiers cannot be quoted and must follow all Transact-SQL rules for identifiers.&lt;br /&gt;&lt;br /&gt;What is the STUFF function and how does it differ from the REPLACE function?&lt;br /&gt;STUFF function to overwrite existing characters. Using this syntax, STUFF(string_expression, start, length, replacement_characters), string_expression is the string that will have characters substituted, start is the starting position, length is the number of characters in the string that are substituted, and replacement_characters are the new characters interjected into the string.&lt;br /&gt;REPLACE function to replace existing characters of all occurance. Using this syntax REPLACE(string_expression, search_string, replacement_string), where every incidence of search_string found in the string_expression will be replaced with replacement_string.&lt;br /&gt;&lt;br /&gt;Using query analyzer, name 3 ways to get an accurate count of the number of records in a table?&lt;br /&gt;&lt;br /&gt;SELECT * &lt;br /&gt;&lt;br /&gt;    FROM table1&lt;br /&gt;&lt;br /&gt;SELECT COUNT(*) &lt;br /&gt;&lt;br /&gt;    FROM table1&lt;br /&gt;&lt;br /&gt;SELECT rows &lt;br /&gt;&lt;br /&gt;    FROM sysindexes &lt;br /&gt;&lt;br /&gt;    WHERE id = OBJECT_ID(table1) &lt;br /&gt;&lt;br /&gt;        AND indid &lt; 2&lt;br /&gt;&lt;br /&gt;How to rebuild Master Database?&lt;br /&gt;Shutdown Microsoft SQL Server 2000, and then run Rebuildm.exe. This is located in the Program Files\Microsoft SQL Server\80\Tools\Binn directory.&lt;br /&gt;In the Rebuild Master dialog box, click Browse.&lt;br /&gt;In the Browse for Folder dialog box, select the \Data folder on the SQL Server 2000 compact disc or in the shared network directory from which SQL Server 2000 was installed, and then click OK.&lt;br /&gt;Click Settings. In the Collation Settings dialog box, verify or change settings used for the master database and all other databases.&lt;br /&gt;Initially, the default collation settings are shown, but these may not match the collation selected during setup. You can select the same settings used during setup or select new collation settings. When done, click OK.&lt;br /&gt;In the Rebuild Master dialog box, click Rebuild to start the process.&lt;br /&gt;The Rebuild Master utility reinstalls the master database.&lt;br /&gt;To continue, you may need to stop a server that is running.&lt;br /&gt;Source: http://msdn2.microsoft.com/en-us/library/aa197950(SQL.80).aspx&lt;br /&gt;&lt;br /&gt;What is the basic functions for master, msdb, model, tempdb databases?&lt;br /&gt;The Master database holds information for all databases located on the SQL Server instance and is the glue that holds the engine together. Because SQL Server cannot start without a functioning master database, you must administer this database with care.&lt;br /&gt;The msdb database stores information regarding database backups, SQL Agent information, DTS packages, SQL Server jobs, and some replication information such as for log shipping.&lt;br /&gt;The tempdb holds temporary objects such as global and local temporary tables and stored procedures.&lt;br /&gt;The model is essentially a template database used in the creation of any new user database created in the instance.&lt;br /&gt;&lt;br /&gt;What are primary keys and foreign keys?&lt;br /&gt;Primary keys are the unique identifiers for each row. They must contain unique values and cannot be null. Due to their importance in relational databases, Primary keys are the most fundamental of all keys and constraints. A table can have only one Primary key.&lt;br /&gt;Foreign keys are both a method of ensuring data integrity and a manifestation of the relationship between tables.&lt;br /&gt;&lt;br /&gt;What is data integrity? Explain constraints?&lt;br /&gt;Data integrity is an important feature in SQL Server. When used properly, it ensures that data is accurate, correct, and valid. It also acts as a trap for otherwise undetectable bugs within applications.&lt;br /&gt;A PRIMARY KEY constraint is a unique identifier for a row within a database table. Every table should have a primary key constraint to uniquely identify each row and only one primary key constraint can be created for each table. The primary key constraints are used to enforce entity integrity.&lt;br /&gt;&lt;br /&gt;A UNIQUE constraint enforces the uniqueness of the values in a set of columns, so no duplicate values are entered. The unique key constraints are used to enforce entity integrity as the primary key constraints.&lt;br /&gt;&lt;br /&gt;A FOREIGN KEY constraint prevents any actions that would destroy links between tables with the corresponding data values. A foreign key in one table points to a primary key in another table. Foreign keys prevent actions that would leave rows with foreign key values when there are no primary keys with that value. The foreign key constraints are used to enforce referential integrity.&lt;br /&gt;&lt;br /&gt;A CHECK constraint is used to limit the values that can be placed in a column. The check constraints are used to enforce domain integrity.&lt;br /&gt;&lt;br /&gt;A NOT NULL constraint enforces that the column will not accept null values. The not null constraints are used to enforce domain integrity, as the check constraints.&lt;br /&gt;&lt;br /&gt;What are the properties of the Relational tables?&lt;br /&gt;Relational tables have six properties:&lt;br /&gt;&lt;br /&gt;    * Values are atomic.&lt;br /&gt;    * Column values are of the same kind.&lt;br /&gt;    * Each row is unique.&lt;br /&gt;    * The sequence of columns is insignificant.&lt;br /&gt;    * The sequence of rows is insignificant.&lt;br /&gt;    * Each column must have a unique name.&lt;br /&gt;&lt;br /&gt;What is De-normalization?&lt;br /&gt;De-normalization is the process of attempting to optimize the performance of a database by adding redundant data. It is sometimes necessary because current DBMSs implement the relational model poorly. A true relational DBMS would allow for a fully normalized database at the logical level, while providing physical storage of data that is tuned for high performance. De-normalization is a technique to move from higher to lower normal forms of database modeling in order to speed up database access.&lt;br /&gt;&lt;br /&gt;How to get @@error and @@rowcount at the same time?&lt;br /&gt;If @@Rowcount is checked after Error checking statement then it will have 0 as the value of @@Recordcount as it would have been reset.&lt;br /&gt;And if @@Recordcount is checked before the error-checking statement then @@Error would get reset. To get @@error and @@rowcount at the same time do both in same statement and store them in local variable. SELECT @RC = @@ROWCOUNT, @ER = @@ERROR&lt;br /&gt;&lt;br /&gt;What is Identity?&lt;br /&gt;Identity (or AutoNumber) is a column that automatically generates numeric values. A start and increment value can be set, but most DBA leave these at 1. A GUID column also generates numbers, the value of this cannot be controled. Identity/GUID columns do not need to be indexed.&lt;br /&gt;&lt;br /&gt;What is a Scheduled Jobs or What is a Scheduled Tasks?&lt;br /&gt;Scheduled tasks let user automate processes that run on regular or predictable cycles. User can schedule administrative tasks, such as cube processing, to run during times of slow business activity. User can also determine the order in which tasks run by creating job steps within a SQL Server Agent job. E.g. Back up database, Update Stats of Tables. Job steps give user control over flow of execution. If one job fails, user can configure SQL Server Agent to continue to run the remaining tasks or to stop execution.&lt;br /&gt;&lt;br /&gt;What is a table called, if it does not have neither Cluster nor Non-cluster Index? What is it used for?&lt;br /&gt;Unindexed table or Heap. Microsoft Press Books and Book On Line (BOL) refers it as Heap.&lt;br /&gt;A heap is a table that does not have a clustered index and, therefore, the pages are not linked by pointers. The IAM pages are the only structures that link the pages in a table together.&lt;br /&gt;Unindexed tables are good for fast storing of data. Many times it is better to drop all indexes from table and than do bulk of inserts and to restore those indexes after that.&lt;br /&gt;&lt;br /&gt;What is BCP? When does it used?&lt;br /&gt;BulkCopy is a tool used to copy huge amount of data from tables and views. BCP does not copy the structures same as source to destination.&lt;br /&gt;&lt;br /&gt;How do you load large data to the SQL server database?&lt;br /&gt;BulkCopy is a tool used to copy huge amount of data from tables. BULK INSERT command helps to Imports a data file into a database table or view in a user-specified format.&lt;br /&gt;&lt;br /&gt;Can we rewrite subqueries into simple select statements or with joins?&lt;br /&gt;Subqueries can often be re-written to use a standard outer join, resulting in faster performance. As we may know, an outer join uses the plus sign (+) operator to tell the database to return all non-matching rows with NULL values. Hence we combine the outer join with a NULL test in the WHERE clause to reproduce the result set without using a sub-query.&lt;br /&gt;&lt;br /&gt;Can SQL Servers linked to other servers like Oracle?&lt;br /&gt;SQL Server can be lined to any server provided it has OLE-DB provider from Microsoft to allow a link. E.g. Oracle has a OLE-DB provider for oracle that Microsoft provides to add it as linked server to SQL Server group.&lt;br /&gt;&lt;br /&gt;How to know which index a table is using?&lt;br /&gt;SELECT table_name,index_name FROM user_constraints&lt;br /&gt;&lt;br /&gt;How to copy the tables, schema and views from one SQL server to another?&lt;br /&gt;Microsoft SQL Server 2000 Data Transformation Services (DTS) is a set of graphical tools and programmable objects that lets user extract, transform, and consolidate data from disparate sources into single or multiple destinations.&lt;br /&gt;&lt;br /&gt;What is Self Join?&lt;br /&gt;This is a particular case when one table joins to itself, with one or two aliases to avoid confusion. A self join can be of any type, as long as the joined tables are the same. A self join is rather unique in that it involves a relationship with only one table. The common example is when company have a hierarchal reporting structure whereby one member of staff reports to another.&lt;br /&gt;&lt;br /&gt;What is Cross Join?&lt;br /&gt;A cross join that does not have a WHERE clause produces the Cartesian product of the tables involved in the join. The size of a Cartesian product result set is the number of rows in the first table multiplied by the number of rows in the second table. The common example is when company wants to combine each product with a pricing table to analyze each product at each price.&lt;br /&gt;&lt;br /&gt;Which virtual table does a trigger use?&lt;br /&gt;Inserted and Deleted.&lt;br /&gt;&lt;br /&gt;List few advantages of Stored Procedure.&lt;br /&gt;&lt;br /&gt;    * Stored procedure can reduced network traffic and latency, boosting application performance.&lt;br /&gt;    * Stored procedure execution plans can be reused, staying cached in SQL Server’s memory, reducing server overhead.&lt;br /&gt;    * Stored procedures help promote code reuse.&lt;br /&gt;    * Stored procedures can encapsulate logic. You can change stored procedure code without affecting clients.&lt;br /&gt;    * Stored procedures provide better security to your data.&lt;br /&gt;&lt;br /&gt;What is DataWarehousing?&lt;br /&gt;&lt;br /&gt;    * Subject-oriented, meaning that the data in the database is organized so that all the data elements relating to the same real-world event or object are linked together;&lt;br /&gt;    * Time-variant, meaning that the changes to the data in the database are tracked and recorded so that reports can be produced showing changes over time;&lt;br /&gt;    * Non-volatile, meaning that data in the database is never over-written or deleted, once committed, the data is static, read-only, but retained for future reporting;&lt;br /&gt;    * Integrated, meaning that the database contains data from most or all of an organization’s operational applications, and that this data is made consistent.&lt;br /&gt;&lt;br /&gt;What is OLTP(OnLine Transaction Processing)?&lt;br /&gt;In OLTP - online transaction processing systems relational database design use the discipline of data modeling and generally follow the Codd rules of data normalization in order to ensure absolute data integrity. Using these rules complex information is broken down into its most simple structures (a table) where all of the individual atomic level elements relate to each other and satisfy the normalization rules.&lt;br /&gt;&lt;br /&gt;How do SQL server 2000 and XML linked? Can XML be used to access data?&lt;br /&gt;FOR XML (ROW, AUTO, EXPLICIT)&lt;br /&gt;You can execute SQL queries against existing relational databases to return results as XML rather than standard rowsets. These queries can be executed directly or from within stored procedures. To retrieve XML results, use the FOR XML clause of the SELECT statement and specify an XML mode of RAW, AUTO, or EXPLICIT.&lt;br /&gt;&lt;br /&gt;OPENXML&lt;br /&gt;OPENXML is a Transact-SQL keyword that provides a relational/rowset view over an in-memory XML document. OPENXML is a rowset provider similar to a table or a view. OPENXML provides a way to access XML data within the Transact-SQL context by transferring data from an XML document into the relational tables. Thus, OPENXML allows you to manage an XML document and its interaction with the relational environment.&lt;br /&gt;&lt;br /&gt;What is an execution plan? When would you use it? How would you view the execution plan?&lt;br /&gt;An execution plan is basically a road map that graphically or textually shows the data retrieval methods chosen by the SQL Server query optimizer for a stored procedure or ad-hoc query and is a very useful tool for a developer to understand the performance characteristics of a query or stored procedure since the plan is the one that SQL Server will place in its cache and use to execute the stored procedure or query. From within Query Analyzer is an option called “Show Execution Plan” (located on the Query drop-down menu). If this option is turned on it will display query execution plan in separate window when query is ran again.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4570388358056942020-162553386106904981?l=deiva-apk.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://deiva-apk.blogspot.com/feeds/162553386106904981/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4570388358056942020&amp;postID=162553386106904981' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4570388358056942020/posts/default/162553386106904981'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4570388358056942020/posts/default/162553386106904981'/><link rel='alternate' type='text/html' href='http://deiva-apk.blogspot.com/2009/06/sql-interview-questions.html' title='Sql Interview Questions'/><author><name>Deiva</name><uri>http://www.blogger.com/profile/01579444991016554353</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://2.bp.blogspot.com/_yOUXlZCsLwo/SijGXeEKTcI/AAAAAAAAAC4/wZCfvpFCaTQ/S220/IMG_2074.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4570388358056942020.post-8032697370777048431</id><published>2009-05-26T10:13:00.002+05:30</published><updated>2009-05-26T10:17:50.474+05:30</updated><title type='text'>Nullable Types in C#</title><content type='html'>In 1.x days we cannot assign a null value to value types.Assigning a null value will throw an error.&lt;br /&gt;&lt;br /&gt;int mobile = null; //Will throw an error&lt;br /&gt;&lt;br /&gt;This is an inconvenience whenever we are retrieving a value from a database that can allow nulls and assigning to .net variable. But this inconvenience is no more now because of the Nullable types. A nullable type can be declared similar to normal variable but with ? modifier at the end of keyword.&lt;br /&gt;&lt;br /&gt;i.e., a valid nullable type declaration will be, &lt;br /&gt;&lt;br /&gt;int? mobile = null; &lt;br /&gt;&lt;br /&gt;Alternatively we can declare like,&lt;br /&gt;&lt;br /&gt;Nullable&lt;int&gt; mobile = null;&lt;br /&gt;&lt;br /&gt;int? will be the shorthand notation of Nullable&lt;int&gt;.&lt;br /&gt;&lt;br /&gt;Things to know about Nullable Types:&lt;br /&gt;&lt;br /&gt;Nullabe types are instances of System.Nullable struct.Nullable type structure differs from normal type by having flag extra to indicate whether it contain null value.Additional it have 2 other properties which we will be looking in detail in this article.&lt;br /&gt;&lt;br /&gt;Working with Nullable Types:&lt;br /&gt;How to retrieve the value from a nullable type?&lt;br /&gt;&lt;br /&gt;As we discussed early it has 2 other property called Has Value and Value.&lt;br /&gt;Value:&lt;br /&gt;&lt;br /&gt;This property is a read only property which retrieves the value associated with the type.This property will throw an exception when it is accessed with a null value.&lt;br /&gt;&lt;br /&gt;int? mobile = null;&lt;br /&gt;int my mobile = mobile.Value;&lt;br /&gt;&lt;br /&gt;The above line will throw a exception,&lt;br /&gt;&lt;br /&gt;"Invalid operation exception"&lt;br /&gt;&lt;br /&gt;Nullable object should have value.&lt;br /&gt;&lt;br /&gt;HasValue:&lt;br /&gt;&lt;br /&gt;This property returns a Boolean indicating whether the variable contains a value.&lt;br /&gt;So the above exception can be prevented by writing the code like,&lt;br /&gt;&lt;br /&gt;if (mobile.HasValue)&lt;br /&gt;{&lt;br /&gt;   int mymobile = mobile.Value;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Consider a situation like,&lt;br /&gt;&lt;br /&gt;int? n1 = 2;&lt;br /&gt;int n2 = 3;&lt;br /&gt;&lt;br /&gt;Now what will be output type of (n1*n2) ?&lt;br /&gt;&lt;br /&gt;int sum = n1 * n2;&lt;br /&gt;&lt;br /&gt;The above operation will throw an error.&lt;br /&gt;&lt;br /&gt;This operation gives a result which a nullable type can hold and thus it can be assigned to a variable like,&lt;br /&gt;&lt;br /&gt;int? sum = n1 * n2;&lt;br /&gt;&lt;br /&gt;We can call these operators as Lifted operator’s i.e., it will lift the non nullable type to nullable type. Assigning null to any of the above variable will result null. The same behavior applies to + and – operators.&lt;br /&gt;&lt;br /&gt;Getting a default value with Nullable Types:&lt;br /&gt;&lt;br /&gt;int? n1 = null;&lt;br /&gt;&lt;br /&gt;int n2 = 3;&lt;br /&gt;&lt;br /&gt;(n1 ?? 10) will return the value 10.This will be useful when we are fetching a allow null field from database and assigning to a non nullable type or it can be used in a operation like below. Hence we can assign a default value.&lt;br /&gt;&lt;br /&gt;int product = (n1 ?? 10) * n2;&lt;br /&gt;&lt;br /&gt;Now product will hold 30 since (n1 ?? 10) will return 10. &lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Note:&lt;span style="font-style:italic;"&gt;&lt;span style="font-style:italic;"&gt;&lt;span style="font-weight:bold;"&gt;&lt;span style="font-weight:bold;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;We cannot create nullable types with reference types.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4570388358056942020-8032697370777048431?l=deiva-apk.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://deiva-apk.blogspot.com/feeds/8032697370777048431/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4570388358056942020&amp;postID=8032697370777048431' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4570388358056942020/posts/default/8032697370777048431'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4570388358056942020/posts/default/8032697370777048431'/><link rel='alternate' type='text/html' href='http://deiva-apk.blogspot.com/2009/05/nullable-types-in-c.html' title='Nullable Types in C#'/><author><name>Deiva</name><uri>http://www.blogger.com/profile/01579444991016554353</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://2.bp.blogspot.com/_yOUXlZCsLwo/SijGXeEKTcI/AAAAAAAAAC4/wZCfvpFCaTQ/S220/IMG_2074.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4570388358056942020.post-2832088063297044226</id><published>2009-04-24T13:01:00.002+05:30</published><updated>2009-04-24T13:07:21.241+05:30</updated><title type='text'>Nested Classes in C#</title><content type='html'>&lt;strong&gt;Introduction&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;In this short tutorial we are going to discuss nested classes. Nested classes are classes within classes. Let us try and understand better by writing simple programs.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;P1.cs&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;class OurOuterClass&lt;br /&gt;{&lt;br /&gt;    public static void Main()&lt;br /&gt;    {&lt;br /&gt;        System.Console.WriteLine("OurOuterClass");&lt;br /&gt;    } &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Output&lt;/strong&gt;:&lt;br /&gt;OurOuterClass&lt;br /&gt;&lt;br /&gt;The above program compiles and runs successfully to give the desired output. The above program consists of one single class named OurOuterClass. OK! So let's try another class within OurOuterClass.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;P2.cs&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;class OurOuterClass&lt;br /&gt;{&lt;br /&gt;    public static void Main()&lt;br /&gt;    {&lt;br /&gt;        System.Console.WriteLine("OurOuterClass");&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    class OurNestedClass&lt;br /&gt;    {&lt;br /&gt;&lt;br /&gt;    } &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Output&lt;/strong&gt;:&lt;br /&gt;&lt;br /&gt;OurOuterClass&lt;br /&gt;&lt;br /&gt;The above program compiles and runs successfully to give the desired output. The above program consists of one single class named OurOuterClass. Not only that! OurOuterClass contains OurNestedClass within it. That's the nested class.&lt;br /&gt;&lt;br /&gt;Let's understand how a nested class looks through one more example.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;P3.cs&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;class Demo&lt;br /&gt;{&lt;br /&gt;    public static void Main()&lt;br /&gt;    {&lt;br /&gt;        System.Console.WriteLine("DemoClass");&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;class OuterClass&lt;br /&gt;{&lt;br /&gt;    class NestedClass&lt;br /&gt;    {&lt;br /&gt;&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Output&lt;/strong&gt;:&lt;br /&gt;&lt;br /&gt;DemoClass&lt;br /&gt;&lt;br /&gt;The above program compiles and runs successfully to give the desired output. The above program consists of three classes: the Demo class that consists of the Main method, the outer class named OuterClass, and the nested Class named NestedClass within the outer class.&lt;br /&gt;&lt;br /&gt;Now let's explore the nested classes. Can we create an object of NestedClass from within the Demo class? Let's find out.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;P4.cs&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;class Demo&lt;br /&gt;{&lt;br /&gt;    public static void Main()&lt;br /&gt;    {&lt;br /&gt;        System.Console.WriteLine("DemoClass");&lt;br /&gt;        NestedClass obj = new NestedClass();&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;class OuterClass&lt;br /&gt;{&lt;br /&gt;    class NestedClass&lt;br /&gt;    {&lt;br /&gt;&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Output&lt;/strong&gt;:&lt;br /&gt;&lt;br /&gt;P4.cs(6,7): error CS0246: The type or namespace name 'NestedClass' could not &lt;br /&gt;be found (are you missing a using directive or an assembly reference?)&lt;br /&gt;&lt;br /&gt;P4.cs(6,29): error CS0246: The type or namespace name 'NestedClass' could not &lt;br /&gt;be found (are you missing a using directive or an assembly reference?)&lt;br /&gt;Error! That's because the Demo class is not allowed to use the class NestedClass directly as it is contained within the class OuterClass. OK! So can we create an object of NestedClass from within the OuterClass? Let's find out.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;P5.cs&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;class Demo&lt;br /&gt;{&lt;br /&gt;    public static void Main()&lt;br /&gt;    {&lt;br /&gt;        System.Console.WriteLine("DemoClass");&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;class OuterClass&lt;br /&gt;{&lt;br /&gt;    class NestedClass&lt;br /&gt;    {&lt;br /&gt;&lt;br /&gt;    }&lt;br /&gt;    public void CreateObjectOfNestedClass()&lt;br /&gt;    {&lt;br /&gt;        NestedClass obj = new NestedClass();&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Output&lt;/strong&gt;:&lt;br /&gt;&lt;br /&gt;DemoClass&lt;br /&gt;&lt;br /&gt;The above program compiles and runs successfully to give the desired output. The above program shows that we can create an object of NestedClass from within the OuterClass. In the above program we have defined a new method CreateObjectOfNestedClass() within the OuterClass. Inside this method we have created the object of NestedClass.&lt;br /&gt;&lt;br /&gt;What if we want to get a reference to a NestedClass object obj from within the Demo class? Well, we need to modify the function CreateObjectOfNestedClass() to return an object of type NestedClass. Then in the Main() block of the Demo class, we need to create an object of OuterClass. Then we need to invoke the function CreateObjectOfNestedClass() using the object from OuterClass. The CreateObjectOfNestedClass() returns the object obj of NestedClass. We catch this object in the reference of type NestedClass, created in the Main() block of the Demo class. This is what the following program does:&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;P6.cs&lt;/strong&gt;&lt;br /&gt;class Demo&lt;br /&gt;{&lt;br /&gt;    public static void Main()&lt;br /&gt;    {&lt;br /&gt;        System.Console.WriteLine("DemoClass");&lt;br /&gt;&lt;br /&gt;        OuterClass oc = new OuterClass();&lt;br /&gt;        NestedClass reference = oc.CreateObjectOfNestedClass();&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;class OuterClass&lt;br /&gt;{&lt;br /&gt;    class NestedClass&lt;br /&gt;    {&lt;br /&gt;&lt;br /&gt;    }&lt;br /&gt;    public void CreateObjectOfNestedClass()&lt;br /&gt;    {&lt;br /&gt;        NestedClass obj = new NestedClass();&lt;br /&gt;        return obj;&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Output&lt;/strong&gt;:&lt;br /&gt;&lt;br /&gt;P6.cs(9,7): error CS0246: The type or namespace name 'NestedClass' could not &lt;br /&gt;be found (are you missing a using directive or an assembly reference?)&lt;br /&gt;Error! We did everything according to our initial plan. Then where did we fail? Well we failed at line 9 where we are referencing the nested class directly from Main() in the Demo class. Didn't we learn from programs P3.cs and P4.cs that the Demo class is not allowed to use NestedClass directly, as it is contained within the OuterClass? Certainly we did. So what's the solution to this problem? We need to know the right way to reference the NestedClass from Main() inside Demo. Well we need to use the fully qualified name for NestedClass within Main() in the Demo class, which is done with the following program.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;P7.cs&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;class Demo&lt;br /&gt;{&lt;br /&gt;    public static void Main()&lt;br /&gt;    {&lt;br /&gt;        System.Console.WriteLine("DemoClass");&lt;br /&gt;&lt;br /&gt;        OuterClass oc = new OuterClass();&lt;br /&gt;        OuterClass.NestedClass reference = oc.CreateObjectOfNestedClass();&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;class OuterClass&lt;br /&gt;{&lt;br /&gt;    class NestedClass&lt;br /&gt;    {&lt;br /&gt;&lt;br /&gt;    }&lt;br /&gt;    public NestedClass CreateObjectOfNestedClass()&lt;br /&gt;    {&lt;br /&gt;        NestedClass obj = new NestedClass();&lt;br /&gt;        return obj;&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Output&lt;/strong&gt;:&lt;br /&gt;&lt;br /&gt;P7.cs(19,23): error CS0050: Inconsistent accessibility: return type &lt;br /&gt;'OuterClass.NestedClass' is less accessible than method &lt;br /&gt;'OuterClass.CreateObjectOfNestedClass()'&lt;br /&gt;&lt;br /&gt;P7.cs(15,10): (Location of symbol related to previous error)&lt;br /&gt;Error again! Now where did we go wrong? The compiler error tells us that we need to make the class NestedClass public.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;P8.cs&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;class Demo&lt;br /&gt;{&lt;br /&gt;    public static void Main()&lt;br /&gt;    {&lt;br /&gt;        System.Console.WriteLine("DemoClass");&lt;br /&gt;&lt;br /&gt;        OuterClass oc = new OuterClass();&lt;br /&gt;        OuterClass.NestedClass reference = oc.CreateObjectOfNestedClass();&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;class OuterClass&lt;br /&gt;{&lt;br /&gt;    public class NestedClass&lt;br /&gt;    {&lt;br /&gt;&lt;br /&gt;    }&lt;br /&gt;    public NestedClass CreateObjectOfNestedClass()&lt;br /&gt;    {&lt;br /&gt;        NestedClass obj = new NestedClass();&lt;br /&gt;        return obj;&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Output&lt;/strong&gt;:&lt;br /&gt;&lt;br /&gt;DemoClass&lt;br /&gt;&lt;br /&gt;Bingo! The above program compiles and runs successfully to give the desired output. We know that we can reference the NestedClass from Main() in Demo by using its fully qualified name, and making the NestedClass public. Then can we do away with the extra headache of creating object oc of OuterClass and invoking oc.CreateObjectOfNestedClass()? Yes, certainly we can get rid of this headache. We can get rid of CreateObjectOfNestedClass() defined within the NestedClass class. This is how we do so.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;P9.cs&lt;/strong&gt;&lt;br /&gt;class Demo&lt;br /&gt;{&lt;br /&gt;    public static void Main()&lt;br /&gt;    {&lt;br /&gt;        System.Console.WriteLine("DemoClass");&lt;br /&gt;        OuterClass.NestedClass reference = new OuterClass.NestedClass();&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;class OuterClass&lt;br /&gt;{&lt;br /&gt;    public class NestedClass&lt;br /&gt;    {&lt;br /&gt;&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Output&lt;/strong&gt;:&lt;br /&gt;&lt;br /&gt;DemoClass&lt;br /&gt;&lt;br /&gt;The above program compiles and runs successfully to give the desired output. Wasn't that simple?&lt;br /&gt;&lt;br /&gt;Nested Classes and Static Members&lt;br /&gt;&lt;br /&gt;Let us see how nested classes behave with the static members.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;P10.cs&lt;/strong&gt;&lt;br /&gt;class Demo&lt;br /&gt;{&lt;br /&gt;    public static void Main()&lt;br /&gt;    {&lt;br /&gt;        System.Console.WriteLine(OuterClass.NestedClass.x);     &lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;class OuterClass&lt;br /&gt;{&lt;br /&gt;    public class NestedClass&lt;br /&gt;    {&lt;br /&gt;        public static int x = 100;&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Output&lt;/strong&gt;:&lt;br /&gt;&lt;br /&gt;100&lt;br /&gt;&lt;br /&gt;The instance class is not required to access static variables. The rules that apply to standalone classes in case of static variables also apply to nested classes. For nested classes, fully qualified names of nested classes must be used to access the static variables as shown by the above program.&lt;br /&gt;&lt;br /&gt;Nested Classes and Members in Containers&lt;br /&gt;&lt;br /&gt;Let us see how nested classes behave with the members in containing classes.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;P11.cs&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;class Demo&lt;br /&gt;{&lt;br /&gt;  public static void Main()&lt;br /&gt;  {&lt;br /&gt;      System.Console.WriteLine("Demo");     &lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt; &lt;br /&gt;class OuterClass&lt;br /&gt;{&lt;br /&gt;   public int y = 100;&lt;br /&gt; &lt;br /&gt;   public class NestedClass&lt;br /&gt;   {&lt;br /&gt;      public void abc()&lt;br /&gt;      {&lt;br /&gt;          System.Console.WriteLine(y);     &lt;br /&gt;      }&lt;br /&gt;   }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Output&lt;/strong&gt;:&lt;br /&gt;&lt;br /&gt;P11.cs(17,35): error CS0038: Cannot access a nonstatic member of outer type&lt;br /&gt;&lt;br /&gt;'OuterClass' via nested type 'OuterClass.NestedClass'&lt;br /&gt;Error! That's because the NestedClass cannot access the non-static, member y declared in the OuterClass. The members of the OuterClass are not directly available to the NestedClass. Well, then how can the NestedClass access the members of the containing class? This is how:&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;P12.cs&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;class Demo&lt;br /&gt;{&lt;br /&gt;  public static void Main()&lt;br /&gt;  {&lt;br /&gt;      System.Console.WriteLine("Demo");&lt;br /&gt;      OuterClass.NestedClass.abc();     &lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt; &lt;br /&gt;class OuterClass&lt;br /&gt;{&lt;br /&gt;   public static int y = 100;&lt;br /&gt; &lt;br /&gt;   public class NestedClass&lt;br /&gt;   {&lt;br /&gt;      public static void abc()&lt;br /&gt;      {&lt;br /&gt;              System.Console.WriteLine(OuterClass.y);     &lt;br /&gt;      }&lt;br /&gt;   }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Output&lt;/strong&gt;:&lt;br /&gt;&lt;br /&gt;Demo&lt;br /&gt;&lt;br /&gt;100&lt;br /&gt;&lt;br /&gt;The above program compiles and runs successfully to give the desired output. NestedClass can access static member y declared in the OuterClass. Declaring a member as static in the OuterClass makes it directly available in the NestedClass.&lt;br /&gt;&lt;br /&gt;It is not always necessary to declare an outer class member as static to make it directly available in the nested class. There is one more way by which the nested class can directly access non-static members of the container class. This is how:&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;P13.cs&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;class Demo&lt;br /&gt;{&lt;br /&gt;    public static void Main()&lt;br /&gt;    {&lt;br /&gt;        System.Console.WriteLine("Demo");&lt;br /&gt;        OuterClass.NestedClass.abc();     &lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;class OuterClass&lt;br /&gt;{&lt;br /&gt;    public int y = 100;&lt;br /&gt;&lt;br /&gt;    public class NestedClass&lt;br /&gt;    {&lt;br /&gt;        public static void abc()&lt;br /&gt;        {&lt;br /&gt;            OuterClass oc = new OuterClass();&lt;br /&gt;            System.Console.WriteLine(oc.y);     &lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Output&lt;/strong&gt;:&lt;br /&gt;&lt;br /&gt;Demo&lt;br /&gt;&lt;br /&gt;100&lt;br /&gt;&lt;br /&gt;The above program compiles and runs successfully to give the desired output. The NestedClass can access the non static members of the container class via objects created in the nested class. In the above program the function abc() is a member of the nested class. Inside the function abc() we have created the object of the outer class and then we are accessing the non static member y of the OuterClass.&lt;br /&gt;&lt;br /&gt;Constructors and Nested Classes&lt;br /&gt;&lt;br /&gt;Let us try to understand (through small examples) how constructors in outer and nested classes behave.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;P14.cs&lt;/strong&gt;&lt;br /&gt;class Demo&lt;br /&gt;{&lt;br /&gt;    public static void Main()&lt;br /&gt;    {&lt;br /&gt;        System.Console.WriteLine("Demo");&lt;br /&gt;        OuterClass oc = new OuterClass();    &lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;class OuterClass&lt;br /&gt;{&lt;br /&gt;    public OuterClass()&lt;br /&gt;    {&lt;br /&gt;        System.Console.WriteLine("OuterClass");     &lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public class NestedClass&lt;br /&gt;    {&lt;br /&gt;        public NestedClass()&lt;br /&gt;        {&lt;br /&gt;            System.Console.WriteLine("NestedClass");     &lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Output&lt;/strong&gt;:&lt;br /&gt;&lt;br /&gt;Demo&lt;br /&gt;&lt;br /&gt;OuterClass&lt;br /&gt;&lt;br /&gt;The above program compiles and runs successfully to give the desired output. An attempt was made to create an object of OuterClass. Therefore the constructor of OuterClass got executed. There is no reason why the constructor of NestedClass should get executed.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;P15.cs&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;class Demo&lt;br /&gt;{&lt;br /&gt;    public static void Main()&lt;br /&gt;    {&lt;br /&gt;        System.Console.WriteLine("Demo");&lt;br /&gt;        OuterClass.NestedClass nc = new OuterClass.NestedClass();    &lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;class OuterClass&lt;br /&gt;{&lt;br /&gt;    public OuterClass()&lt;br /&gt;    {&lt;br /&gt;        System.Console.WriteLine("OuterClass");     &lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public class NestedClass&lt;br /&gt;    {&lt;br /&gt;        public NestedClass()&lt;br /&gt;        {&lt;br /&gt;            System.Console.WriteLine("NestedClass");     &lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Output&lt;/strong&gt;:&lt;br /&gt;&lt;br /&gt;Demo&lt;br /&gt;&lt;br /&gt;NestedClass&lt;br /&gt;&lt;br /&gt;The above program compiles and runs successfully to give the desired output. An attempt was made to create an object of NestedClass. Therefore the constructor of NestedClass got executed. There is no reason why the constructor of OuterClass should get executed.&lt;br /&gt;&lt;br /&gt;Inheritance and Nested Classes&lt;br /&gt;&lt;br /&gt;We can inherit classes that have already inherited classes. This is how:&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;P16.cs&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;class OuterClass&lt;br /&gt;{&lt;br /&gt;    public OuterClass()&lt;br /&gt;    {&lt;br /&gt;        System.Console.WriteLine("OuterClass");     &lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public class NestedClass&lt;br /&gt;    {&lt;br /&gt;        public NestedClass()&lt;br /&gt;        {&lt;br /&gt;            System.Console.WriteLine("NestedClass");     &lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;class Demo : OuterClass&lt;br /&gt;{&lt;br /&gt;    public static void Main()&lt;br /&gt;    {&lt;br /&gt;        Demo dc = new Demo();    &lt;br /&gt;        System.Console.WriteLine("Demo");&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Output&lt;/strong&gt;:&lt;br /&gt;&lt;br /&gt;OuterClass&lt;br /&gt;&lt;br /&gt;Demo&lt;br /&gt;&lt;br /&gt;The above program compiles and runs successfully to give the desired output. The base class constructor gets executed first and then the derived class's constructor gets executed.&lt;br /&gt;&lt;br /&gt;A final question: can we have a NestedClass inheriting from the OuterClass? Well yes! Check it out.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;P17.cs&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;class Demo&lt;br /&gt;{&lt;br /&gt;    public static void Main()&lt;br /&gt;    {&lt;br /&gt;        System.Console.WriteLine("Demo");&lt;br /&gt;        OuterClass.NestedClass.abc();     &lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;class OuterClass&lt;br /&gt;{&lt;br /&gt;    private int y = 100;&lt;br /&gt;&lt;br /&gt;public class NestedClass : OuterClass&lt;br /&gt;{&lt;br /&gt;    public static void abc()&lt;br /&gt;    {&lt;br /&gt;        OuterClass oc = new OuterClass();&lt;br /&gt;        System.Console.WriteLine(oc.y);     &lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Output&lt;/strong&gt;:&lt;br /&gt;&lt;br /&gt;Demo&lt;br /&gt;&lt;br /&gt;100&lt;br /&gt;&lt;br /&gt;The above program compiles and runs successfully to give the desired output. It is perfectly fine to have a nested class that is derived from the outer class.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4570388358056942020-2832088063297044226?l=deiva-apk.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://deiva-apk.blogspot.com/feeds/2832088063297044226/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4570388358056942020&amp;postID=2832088063297044226' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4570388358056942020/posts/default/2832088063297044226'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4570388358056942020/posts/default/2832088063297044226'/><link rel='alternate' type='text/html' href='http://deiva-apk.blogspot.com/2009/04/nested-classes-in-c.html' title='&lt;strong&gt;&lt;em&gt;Nested Classes in C#&lt;/em&gt;&lt;/strong&gt;'/><author><name>Deiva</name><uri>http://www.blogger.com/profile/01579444991016554353</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://2.bp.blogspot.com/_yOUXlZCsLwo/SijGXeEKTcI/AAAAAAAAAC4/wZCfvpFCaTQ/S220/IMG_2074.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4570388358056942020.post-8362956690245297629</id><published>2009-02-05T11:48:00.002+05:30</published><updated>2009-02-05T11:56:26.911+05:30</updated><title type='text'>Uploading-Images-to-a-Database-C#</title><content type='html'>SQl Table Creation&lt;br /&gt;&lt;br /&gt;CREATE TABLE [dbo].[image] (&lt;br /&gt;[img_pk] [int] IDENTITY (1, 1) NOT NULL ,&lt;br /&gt;[img_name] [varchar] (50) NULL ,&lt;br /&gt;[img_data] [image] NULL ,&lt;br /&gt;[img_contenttype] [varchar] (50) NULL &lt;br /&gt;) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]&lt;br /&gt;GO&lt;br /&gt;&lt;br /&gt;ALTER TABLE [dbo].[image] WITH NOCHECK ADD &lt;br /&gt;CONSTRAINT [PK_image] PRIMARY KEY NONCLUSTERED &lt;br /&gt;(&lt;br /&gt;[img_pk]&lt;br /&gt;) ON [PRIMARY] GO&lt;br /&gt;&lt;br /&gt;in aspx page:&lt;br /&gt;&lt;br /&gt;form id="form1" name="form1" enctype="multipart/form-data" runat="server"&lt;br /&gt;Image Uploader&lt;br /&gt;Enter A Name: input type="text" id="txtImgName" runat="server"&gt;&lt;br /&gt;asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="Required"&lt;br /&gt;ControlToValidate="txtImgName"&gt; /asp:RequiredFieldValidator&gt;&lt;br /&gt;br&gt;&lt;br /&gt;Select File To Upload:&lt;br /&gt;input id="UploadFile" type="file" runat="server"&lt;br /&gt;asp:Button ID="UploadBtn" Text="Upload Me!" OnClick="UploadBtn_Click" runat="server"&lt;br /&gt;/asp:Button&lt;br /&gt;/form&lt;br /&gt;&lt;br /&gt;In .cs File &lt;br /&gt;&lt;br /&gt;using System;&lt;br /&gt;using System.Configuration;&lt;br /&gt;using System.Collections;&lt;br /&gt;using System.ComponentModel;&lt;br /&gt;using System.Data;&lt;br /&gt;using System.Data.SqlClient;&lt;br /&gt;using System.Drawing;&lt;br /&gt;using System.Web;&lt;br /&gt;using System.IO;&lt;br /&gt;using System.Web.SessionState;&lt;br /&gt;using System.Web.UI;&lt;br /&gt;using System.Web.UI.WebControls;&lt;br /&gt;using System.Web.UI.HtmlControls;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;public partial class UploadImage : System.Web.UI.Page&lt;br /&gt;{&lt;br /&gt;    public UploadImage() { }&lt;br /&gt;    protected void Page_Load(object sender, EventArgs e)&lt;br /&gt;    {&lt;br /&gt;&lt;br /&gt;    }&lt;br /&gt;    public void UploadBtn_Click(object sender, System.EventArgs e)&lt;br /&gt;    {&lt;br /&gt;        if (Page.IsValid) //save the image&lt;br /&gt;        {&lt;br /&gt;            Stream imgStream = UploadFile.PostedFile.InputStream;&lt;br /&gt;            int imgLen = UploadFile.PostedFile.ContentLength;&lt;br /&gt;            string imgContentType = UploadFile.PostedFile.ContentType;&lt;br /&gt;            string imgName = txtImgName.Value;&lt;br /&gt;            byte[] imgBinaryData = new byte[imgLen];&lt;br /&gt;            int n = imgStream.Read(imgBinaryData, 0, imgLen);&lt;br /&gt;&lt;br /&gt;            int RowsAffected = SaveToDB(imgName, imgBinaryData, imgContentType);&lt;br /&gt;            if (RowsAffected &gt; 0)&lt;br /&gt;            {&lt;br /&gt;                Response.Write("&lt;BR&gt;The Image was saved");&lt;br /&gt;            }&lt;br /&gt;            else&lt;br /&gt;            {&lt;br /&gt;                Response.Write("&lt;BR&gt;An error occurred uploading the image");&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;    private int SaveToDB(string imgName, byte[] imgbin, string imgcontenttype)&lt;br /&gt;    {&lt;br /&gt;        //use the web.config to store the connection string&lt;br /&gt;        string connectionString = @"Data Source =DEIVAMURUGAN\SQLEXPRESS ;Initial Catalog=master;Integrated Security=True";&lt;br /&gt;        SqlConnection connection = new SqlConnection(connectionString);&lt;br /&gt;&lt;br /&gt;        //SqlConnection connection = new SqlConnection(ConfigurationSettings.AppSettings["conString"]);&lt;br /&gt;        SqlCommand command = new SqlCommand( "INSERT INTO Image (img_name,img_data,img_contenttype) VALUES ( @img_name, @img_data,@img_contenttype )", connection );&lt;br /&gt;&lt;br /&gt;        SqlParameter param0 = new SqlParameter( "@img_name", SqlDbType.VarChar,50 );&lt;br /&gt;        param0.Value = imgName;&lt;br /&gt;        command.Parameters.Add( param0 );&lt;br /&gt;&lt;br /&gt;        SqlParameter param1 = new SqlParameter( "@img_data", SqlDbType.Image );&lt;br /&gt;        param1.Value = imgbin;&lt;br /&gt;        command.Parameters.Add( param1 );&lt;br /&gt;&lt;br /&gt;        SqlParameter param2 = new SqlParameter( "@img_contenttype", SqlDbType.VarChar,50 );&lt;br /&gt;        param2.Value = imgcontenttype;&lt;br /&gt;        command.Parameters.Add( param2 );&lt;br /&gt;&lt;br /&gt;        connection.Open();&lt;br /&gt;        int numRowsAffected = command.ExecuteNonQuery();&lt;br /&gt;        connection.Close();&lt;br /&gt;&lt;br /&gt;        return numRowsAffected;&lt;br /&gt;    }&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4570388358056942020-8362956690245297629?l=deiva-apk.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://deiva-apk.blogspot.com/feeds/8362956690245297629/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4570388358056942020&amp;postID=8362956690245297629' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4570388358056942020/posts/default/8362956690245297629'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4570388358056942020/posts/default/8362956690245297629'/><link rel='alternate' type='text/html' href='http://deiva-apk.blogspot.com/2009/02/uploading-images-to-database-c.html' title='Uploading-Images-to-a-Database-C#'/><author><name>Deiva</name><uri>http://www.blogger.com/profile/01579444991016554353</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://2.bp.blogspot.com/_yOUXlZCsLwo/SijGXeEKTcI/AAAAAAAAAC4/wZCfvpFCaTQ/S220/IMG_2074.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4570388358056942020.post-1092012387626333334</id><published>2009-01-21T16:43:00.002+05:30</published><updated>2009-01-21T16:51:55.933+05:30</updated><title type='text'>Query to Get All the Tables From Database</title><content type='html'>SELECT * FROM information_schema.tables where table_type= 'BASE TABLE'&lt;br /&gt;This Query will return TABLE_CATALOG, TABLE_SCHEMA ,TABLE_NAME and TABLE_TYPE&lt;br /&gt;&lt;br /&gt;SELECT name FROM sysobjects where type ='U'&lt;br /&gt;This Query will return Only TABLE_NAME&lt;br /&gt;&lt;br /&gt;SELECT * FROM sys.Objects where type = 'U'&lt;br /&gt;OR&lt;br /&gt;SELECT * FROM sysObjects where Xtype='U'&lt;br /&gt;&lt;br /&gt;for User Tables&lt;br /&gt;Xtype = 'U'&lt;br /&gt;&lt;br /&gt;for View&lt;br /&gt;Xtype='V'&lt;br /&gt;&lt;br /&gt;for procedures&lt;br /&gt;Xtype='P'&lt;br /&gt;&lt;br /&gt;for Scalar Functions&lt;br /&gt;Xtype = 'FN'&lt;br /&gt;&lt;br /&gt;This Query will return All the Values Regarding to the particular table.&lt;br /&gt;&lt;br /&gt;You can change and use it for getting &lt;em&gt;&lt;strong&gt;nth highest salary&lt;/strong&gt;&lt;/em&gt; from Employee table as follows&lt;br /&gt;&lt;br /&gt;SELECT TOP 1 salary &lt;br /&gt;    FROM (&lt;br /&gt;    SELECT DISTINCT TOP n salary &lt;br /&gt;        FROM employee&lt;br /&gt;        ORDER BY salary DESC) a &lt;br /&gt;    ORDER BY salary&lt;br /&gt;Note:&lt;br /&gt;where n &gt; 1 (n is always greater than one)&lt;br /&gt;&lt;br /&gt;&lt;em&gt;&lt;strong&gt;Select 2nd Highest Salary&lt;/strong&gt;&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;SELECT MAX(Salary) FROM Employee WHERE Salary &lt;&gt; (SELECT MAX(Salary) FROM Employee) &lt;br /&gt;&lt;br /&gt;select MAX(Salary) from Employee where Salary!=(select MAX(Salary) from Employee)&lt;br /&gt;&lt;br /&gt;Select MAX(Salary) From Employee where Salary not in ( Select MAX (Salary) From Employee)&lt;br /&gt;&lt;br /&gt;SELECT TOP 1 Salary FROM (SELECT DISTINCT TOP 2 Salary FROM employee ORDER BY Salary DESC) a ORDER BY Salary&lt;br /&gt;&lt;br /&gt;SELECT DISTINCT TOP 2 Salary FROM employee ORDER BY Salary DESC&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4570388358056942020-1092012387626333334?l=deiva-apk.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://deiva-apk.blogspot.com/feeds/1092012387626333334/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4570388358056942020&amp;postID=1092012387626333334' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4570388358056942020/posts/default/1092012387626333334'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4570388358056942020/posts/default/1092012387626333334'/><link rel='alternate' type='text/html' href='http://deiva-apk.blogspot.com/2009/01/query-to-get-all-tables-from-database.html' title='&lt;em&gt;&lt;strong&gt;Query to Get All the Tables From Database&lt;/strong&gt;&lt;/em&gt;'/><author><name>Deiva</name><uri>http://www.blogger.com/profile/01579444991016554353</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://2.bp.blogspot.com/_yOUXlZCsLwo/SijGXeEKTcI/AAAAAAAAAC4/wZCfvpFCaTQ/S220/IMG_2074.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4570388358056942020.post-8386421138583140166</id><published>2008-12-17T18:04:00.002+05:30</published><updated>2008-12-17T18:18:53.561+05:30</updated><title type='text'>Using dropdownlist in user control and to access the dropdownlist control value in .aspx page</title><content type='html'>A Common requirement we have would be to have a Dropdownlist of items which would be common across all the pages (top navigation or in the left navigation).&lt;br /&gt;&lt;br /&gt;Retrieving the selected item in a dropdownlist which resides in the same page, is pretty straight forward dropdownlist1.selecteditem.value.&lt;br /&gt;&lt;br /&gt;However, when it is in a usercontrol, its pretty difficult to retrieve it since you will get the "Object Reference not set to an instance" error if you try the normal method. Even if you create an instance of the usercontrol and try to access its dropdownlist, you will get the above error.&lt;br /&gt;&lt;br /&gt;The following code demonstrates how to overcome this problem.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;UserControl objCtrl = ((UserControl)(FindControl("Id of the Usercontrol as declared in the container page")));&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;DropDownList ddl = ((DropDownList)(objCtrl.FindControl("Id of the Dropdownlist control in the usercontrol")));&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Response.Write(ddl.SelectedItem.Value);&lt;/strong&gt;&lt;br /&gt;Thats it and you can access the value.&lt;br /&gt;&lt;br /&gt;Cheers and Happy Programming!&lt;em&gt;&lt;/em&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4570388358056942020-8386421138583140166?l=deiva-apk.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://deiva-apk.blogspot.com/feeds/8386421138583140166/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4570388358056942020&amp;postID=8386421138583140166' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4570388358056942020/posts/default/8386421138583140166'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4570388358056942020/posts/default/8386421138583140166'/><link rel='alternate' type='text/html' href='http://deiva-apk.blogspot.com/2008/12/using-dropdownlist-in-user-control-and.html' title='&lt;em&gt;&lt;strong&gt;Using dropdownlist in user control and to access the dropdownlist control value in .aspx page&lt;/strong&gt;&lt;/em&gt;'/><author><name>Deiva</name><uri>http://www.blogger.com/profile/01579444991016554353</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://2.bp.blogspot.com/_yOUXlZCsLwo/SijGXeEKTcI/AAAAAAAAAC4/wZCfvpFCaTQ/S220/IMG_2074.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4570388358056942020.post-4790775919120989231</id><published>2008-12-16T16:25:00.000+05:30</published><updated>2008-12-16T16:26:34.904+05:30</updated><title type='text'>How ASP.NET databinding deals with Eval() and Bind() statements </title><content type='html'>A recent question on one of our internal mailing lists asked where the definition for the Bind() method is located in ASP.NET. The asker had located the definition of the Eval() method on the TemplateControl class, but the Bind() method was nowhere to be found, even using Reflector. &lt;br /&gt;&lt;br /&gt;If you're familiar with databinding in ASP.NET 2.0, you probably know that for read-only values such as Labels you can use the Eval() statement, and for read-write values such as TextBoxes (also known as "two-way databinding") you can use the Bind() statement. Where does that Bind() statement come from? &lt;br /&gt;&lt;br /&gt;To the surprise of many readers, there isn’t a bind method in ASP.NET! When ASP.NET parses your file and sees you're using a databinding expression (in the angle-bracket-percent-pound format, "&lt;%# %&gt;") it has special-case code to parse for the Bind syntax and generates some special code for it. When you use &lt;%# Bind("Name") %&gt; it's not a real function call. If ASP.NET parses the code and detects a Bind() statement, it splits the statement into two parts. The first part is the one-way databinding portion, which ends up being just a regular Eval() call. The second part is the reverse portion, which is typically some code along the lines of "string name = TextBox1.Text" that grabs the value back out from where it was bound.&lt;br /&gt;&lt;br /&gt;Non-Bind() databinding statements are literal code (we use CodeSnippetExpressions in CodeDom), so arbitrary code in the language of your choice is allowed. However, because ASP.NET has to parse Bind() statements, two-way databinding doesn’t support anything other than Bind(). For example, the following syntax is invalid because it tries to invoke arbitrary code and use Bind() at the same time:&lt;br /&gt;                &lt;%# FormatNameHelper(Bind("Name")) %&gt;&lt;br /&gt;The only formats supported in two-way databinding are Bind("field") and Bind("field", "format string {0}"). There are some very minor variations of these syntax examples, such as allowing use of single quotes and not just double quotes. Since some languages supported by ASP.NET favor one format over the other, we have to support both formats, even though the language you're using may support only one.&lt;br /&gt;&lt;br /&gt;The moral of the story is: There are some things that Reflector won't tell you.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4570388358056942020-4790775919120989231?l=deiva-apk.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://deiva-apk.blogspot.com/feeds/4790775919120989231/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4570388358056942020&amp;postID=4790775919120989231' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4570388358056942020/posts/default/4790775919120989231'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4570388358056942020/posts/default/4790775919120989231'/><link rel='alternate' type='text/html' href='http://deiva-apk.blogspot.com/2008/12/how-aspnet-databinding-deals-with-eval.html' title='&lt;strong&gt;How ASP.NET databinding deals with Eval() and Bind() statements &lt;/strong&gt;'/><author><name>Deiva</name><uri>http://www.blogger.com/profile/01579444991016554353</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://2.bp.blogspot.com/_yOUXlZCsLwo/SijGXeEKTcI/AAAAAAAAAC4/wZCfvpFCaTQ/S220/IMG_2074.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4570388358056942020.post-3010945009399895190</id><published>2008-12-02T11:43:00.001+05:30</published><updated>2008-12-02T11:47:35.709+05:30</updated><title type='text'>Types Of  Parameters In C#</title><content type='html'>&lt;strong&gt;Parameters are means:&lt;/strong&gt; way of passing values to a method.The syntax of passing parameter in C# is:&lt;br /&gt;&lt;br /&gt;&lt;em&gt;[modifier] DataType ParameterName&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;There are &lt;strong&gt;four different ways of passing parameters&lt;/strong&gt; to a method in C#. The four different types of parameters are:&lt;br /&gt;&lt;br /&gt;1. Value &lt;br /&gt;2. Out &lt;br /&gt;3. Ref &lt;br /&gt;4. Params&lt;br /&gt;&lt;br /&gt;1. &lt;strong&gt;Value parameters&lt;/strong&gt; This is the default parameter type in C#. If the parameter does not have any modifier it is "value" parameter by default.When we use "value" parameters the actual value is passed to the function,which means changes made to the parameter is local to the function and is not passed back to the calling part.&lt;br /&gt;&lt;br /&gt;using System;&lt;br /&gt;class ParameterInCSharp&lt;br /&gt;{&lt;br /&gt;       static void ParameterType(int intValueParameter)&lt;br /&gt;      {&lt;br /&gt;             intValueParameter = 100;&lt;br /&gt;      }&lt;br /&gt;      static void Main()&lt;br /&gt;      {&lt;br /&gt;              int intAnotherValue = 5;&lt;br /&gt;              ParameterType(intAnotherValue);&lt;br /&gt;              Console.WriteLine(intAnotherValue);                  &lt;br /&gt;      }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Output of the above program would be 5.Eventhough the value of the parameter Param1 is changed within MyMethod it is not passed back to the calling part since value parameters are input only.&lt;br /&gt;&lt;br /&gt;2. &lt;strong&gt;Out parameters&lt;/strong&gt; "out" parameters are output only parameters meaning they can only passback a value from a function.We create a "out" parameter by preceding the parameter data type with the out modifier. When ever a "out" parameter is passed only an unassigned reference is passed to the function.&lt;br /&gt;&lt;br /&gt;using System;&lt;br /&gt;class ParameterInCSharp&lt;br /&gt;{&lt;br /&gt;         static void ParameterType(out int outParameter)&lt;br /&gt;         {&lt;br /&gt;                  outParameter = 100;&lt;br /&gt;         }&lt;br /&gt;         static void Main()&lt;br /&gt;         {&lt;br /&gt;                  int intAnotherValue = 5;&lt;br /&gt;                  ParameterType(intAnotherValue);&lt;br /&gt;                  Console.WriteLine(intAnotherValue);             &lt;br /&gt;         }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Output of the above program would be 100 since the value of the "out" parameter is passed back to the calling part.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Note:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;The modifier "out" should precede the parameter being passed even in the calling part. "out" parameters cannot be used within the function before assigning a value to it. A value should be assigned to the "out" parameter before the method returns.&lt;br /&gt;&lt;br /&gt;3.&lt;strong&gt; Ref parameters &lt;/strong&gt;"ref" parameters are input/output parameters meaning they can be used for passing a value to a function as well as to get back a value from a function.We create a "ref" parameter by preceding the parameter data type with the ref modifier. When ever a "ref" parameter is passed a reference is passed to the function.&lt;br /&gt;&lt;br /&gt;using System;&lt;br /&gt;class ParameterInCSharp&lt;br /&gt;{&lt;br /&gt;         static void ParameterType(ref int refParameter)&lt;br /&gt;         {&lt;br /&gt;                  refParameter = refParameter + 10;&lt;br /&gt;         }&lt;br /&gt;         static void Main()&lt;br /&gt;         {&lt;br /&gt;                  int intAnotherValue=5;&lt;br /&gt;                  ParameterType(intAnotherValue);&lt;br /&gt;                  Console.WriteLine(intAnotherValue);              &lt;br /&gt;         }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Output of the above program would be 15 since the "ref" parameter acts as both input and output.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Note:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;The modifier "ref" should precede the parameter being passed even in the calling part. "ref" parameters should be assigned a value before using it to call a method. 4.Params parameters "params" parameters is a very useful feature in C#. "params" parameter are used when a variable number of arguments need to be passed.The "params" should be a single dimensional or a jagged array.&lt;br /&gt;&lt;br /&gt;using System;&lt;br /&gt;class ParameterTest&lt;br /&gt;{&lt;br /&gt;     static int ParameterType(params int[] paramsParameter)&lt;br /&gt;     {&lt;br /&gt;        int testParameter = 0;&lt;br /&gt;        foreach(int intParams in paramsParameter)&lt;br /&gt;        {&lt;br /&gt;            testParameter = testParameter + intParams;&lt;br /&gt;        }&lt;br /&gt;        return testParameter;&lt;br /&gt;     }&lt;br /&gt;     static void Main()&lt;br /&gt;     {&lt;br /&gt;        Console.WriteLine(ParameterType(1,2,3));&lt;br /&gt;     }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Output of the above program would be 6.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Note:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;The value passed for a "params" parameter can be either comma separated value list or a single dimensional array. "params" parameters are input only.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4570388358056942020-3010945009399895190?l=deiva-apk.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://deiva-apk.blogspot.com/feeds/3010945009399895190/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4570388358056942020&amp;postID=3010945009399895190' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4570388358056942020/posts/default/3010945009399895190'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4570388358056942020/posts/default/3010945009399895190'/><link rel='alternate' type='text/html' href='http://deiva-apk.blogspot.com/2008/12/types-of-parameters-in-c.html' title='&lt;em&gt;&lt;strong&gt;Types Of  Parameters In C#&lt;/strong&gt;&lt;/em&gt;'/><author><name>Deiva</name><uri>http://www.blogger.com/profile/01579444991016554353</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://2.bp.blogspot.com/_yOUXlZCsLwo/SijGXeEKTcI/AAAAAAAAAC4/wZCfvpFCaTQ/S220/IMG_2074.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4570388358056942020.post-789773023673485740</id><published>2008-12-01T16:26:00.002+05:30</published><updated>2008-12-01T16:38:40.922+05:30</updated><title type='text'>MultiSelectDropDownList</title><content type='html'>&lt;a href="http://1.bp.blogspot.com/_yOUXlZCsLwo/STPFd_I4olI/AAAAAAAAACs/1VN-FIjqro4/s1600-h/drop.gif"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 17px; height: 21px;" src="http://1.bp.blogspot.com/_yOUXlZCsLwo/STPFd_I4olI/AAAAAAAAACs/1VN-FIjqro4/s320/drop.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5274776707536560722" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/_yOUXlZCsLwo/STPFdS5W5rI/AAAAAAAAACk/GdipACakhrY/s1600-h/MultiSelectDropDown.JPG"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 320px; height: 263px;" src="http://1.bp.blogspot.com/_yOUXlZCsLwo/STPFdS5W5rI/AAAAAAAAACk/GdipACakhrY/s320/MultiSelectDropDown.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5274776695660275378" /&gt;&lt;/a&gt;&lt;br /&gt;In CSS&lt;br /&gt;.Default&lt;br /&gt;{&lt;br /&gt; font-size:smaller;&lt;br /&gt; font-family:Tahoma; &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;table &lt;br /&gt;{ &lt;br /&gt; padding:0px;&lt;br /&gt; border-collapse:collapse; &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;.DropDownLook&lt;br /&gt;{&lt;br /&gt; padding:0px;&lt;br /&gt; border-style:solid;&lt;br /&gt; border-width:1px;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;.DivClose&lt;br /&gt;{&lt;br /&gt; display:none;&lt;br /&gt; position:absolute;&lt;br /&gt; width:250px;&lt;br /&gt; height:220px;&lt;br /&gt; border-style:solid;&lt;br /&gt; border-color:Gray; &lt;br /&gt; border-width:1px;&lt;br /&gt; background-color:#99A479;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;.LabelClose&lt;br /&gt;{&lt;br /&gt; vertical-align:text-top; &lt;br /&gt; position:absolute;&lt;br /&gt; bottom:0px;&lt;br /&gt; font-family:Verdana;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;.DivCheckBoxList&lt;br /&gt;{&lt;br /&gt; display:none;&lt;br /&gt; background-color:White;&lt;br /&gt; width:250px;&lt;br /&gt; position:absolute;&lt;br /&gt; height:200px;&lt;br /&gt; overflow-y:auto; &lt;br /&gt; overflow-x:hidden;&lt;br /&gt; border-style:solid;&lt;br /&gt; border-color:Gray; &lt;br /&gt; border-width:1px;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;.CheckBoxList&lt;br /&gt;{&lt;br /&gt; position:relative;&lt;br /&gt; width:250px;&lt;br /&gt; height:10px; &lt;br /&gt; overflow:scroll;&lt;br /&gt; font-size:small;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;In .CS&lt;br /&gt;&lt;br /&gt;using System;&lt;br /&gt;using System.Data;&lt;br /&gt;using System.Configuration;&lt;br /&gt;using System.Web;&lt;br /&gt;using System.Web.Security;&lt;br /&gt;using System.Web.UI;&lt;br /&gt;using System.Web.UI.WebControls;&lt;br /&gt;using System.Web.UI.WebControls.WebParts;&lt;br /&gt;using System.Web.UI.HtmlControls;&lt;br /&gt;&lt;br /&gt;public partial class _Default : System.Web.UI.Page &lt;br /&gt;{&lt;br /&gt;    protected void Page_Load(object sender, EventArgs e)&lt;br /&gt;    {&lt;br /&gt;        if (!IsPostBack)&lt;br /&gt;        {&lt;br /&gt;            lstMultipleValues.Attributes.Add("onclick", "FindSelectedItems(this," + txtSelectedMLValues.ClientID + ");");&lt;br /&gt;            SetMultiValue();&lt;br /&gt;            lblDescription.Text = "On click of dropdown, the multi select option will appear.&lt;br /&gt; Once you remove focus from the dropdown"&lt;br /&gt;            + " area it will get auto collapsed. &lt;br /&gt;In case needed, you can go ahead and close it with the close ('X') provided at the bottom.&lt;br /&gt;";&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    protected void SetMultiValue()&lt;br /&gt;    {&lt;br /&gt;        DataTable dt = new DataTable("Table1");&lt;br /&gt;        &lt;br /&gt;        DataColumn dc1 = new DataColumn("Text");&lt;br /&gt;        DataColumn dc2 = new DataColumn("Value");&lt;br /&gt;        dt.Columns.Add(dc1);&lt;br /&gt;        dt.Columns.Add(dc2);&lt;br /&gt;&lt;br /&gt;        //To get enough data for scroll&lt;br /&gt;        dt.Rows.Add("Bangalore", 1);&lt;br /&gt;        dt.Rows.Add("Kolkata", 2);&lt;br /&gt;        dt.Rows.Add("Pune", 3);&lt;br /&gt;        dt.Rows.Add("Mumbai", 4);&lt;br /&gt;        dt.Rows.Add("Noida", 5);&lt;br /&gt;        dt.Rows.Add("Gurgaon", 6);&lt;br /&gt;        dt.Rows.Add("Hyderabad", 7);&lt;br /&gt;        dt.Rows.Add("Chennai", 8);&lt;br /&gt;        dt.Rows.Add("Jaipur", 8);&lt;br /&gt;        dt.Rows.Add("Patna", 8);&lt;br /&gt;        dt.Rows.Add("Ranchi", 8);&lt;br /&gt;&lt;br /&gt;        lstMultipleValues.DataSource = dt;&lt;br /&gt;        lstMultipleValues.DataTextField = "Text";&lt;br /&gt;        lstMultipleValues.DataValueField = "Value";&lt;br /&gt;        lstMultipleValues.DataBind();&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    protected void btnSubmit_Click(object sender, EventArgs e)&lt;br /&gt;    {&lt;br /&gt;        // Text showed that were selected&lt;br /&gt;        lblTextSelected.Text = "Submitted Values: " + txtSelectedMLValues.Value;&lt;br /&gt;&lt;br /&gt;        // One can loop through the checkboxlist control to get the Values too for the text selected if required.&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;In JavaScript&lt;br /&gt;       &lt;br /&gt;        var timoutID;&lt;br /&gt;     function ShowMList()&lt;br /&gt;     {&lt;br /&gt;         var divRef = document.getElementById("divCheckBoxList");&lt;br /&gt;         divRef.style.display = "block";&lt;br /&gt;         var divRefC = document.getElementById("divCheckBoxListClose");&lt;br /&gt;         divRefC.style.display = "block";&lt;br /&gt;     }&lt;br /&gt;     &lt;br /&gt;     function HideMList()&lt;br /&gt;     {&lt;br /&gt;         document.getElementById("divCheckBoxList").style.display = "none";   &lt;br /&gt;         document.getElementById("divCheckBoxListClose").style.display = "none";   &lt;br /&gt;     }&lt;br /&gt;     &lt;br /&gt;        function FindSelectedItems(sender,textBoxID)&lt;br /&gt;        {       &lt;br /&gt;            var cblstTable = document.getElementById(sender.id);&lt;br /&gt;            var checkBoxPrefix = sender.id + "_";&lt;br /&gt;            var noOfOptions = cblstTable.rows.length;&lt;br /&gt;            var selectedText = "";&lt;br /&gt;            for(i=0; i &lt; noOfOptions ; ++i)&lt;br /&gt;            {&lt;br /&gt;                if(document.getElementById(checkBoxPrefix+i).checked)&lt;br /&gt;                {&lt;br /&gt;                    if(selectedText == "")                &lt;br /&gt;                        selectedText = document.getElementById(checkBoxPrefix+i).parentNode.innerText;&lt;br /&gt;                    else&lt;br /&gt;                        selectedText = selectedText + "," + document.getElementById(checkBoxPrefix+i).parentNode.innerText;&lt;br /&gt;                }&lt;br /&gt;            }    &lt;br /&gt;            document.getElementById(textBoxID.id).value = selectedText;   &lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;In .ASPX&lt;br /&gt;&lt;br /&gt;asp:UpdatePanel ID="upDefault" runat="server"&lt;br /&gt;            ContentTemplate     &lt;br /&gt;                asp:Label ID="lblDescription" runat="server" Text="Label"  /asp:Label&lt;br /&gt;                div id="divCustomCheckBoxList" runat="server" onmouseover="clearTimeout(timoutID);" onmouseout="timoutID = setTimeout('HideMList()', 750);"&lt;br /&gt;                    table&lt;br /&gt;                        tr&lt;br /&gt;                            td align="right" class="DropDownLook"&lt;br /&gt;                                input id="txtSelectedMLValues" type="text" readonly="readonly" onclick="ShowMList()" style="width:229px;" runat="server" /&lt;br /&gt;                            /td&lt;br /&gt;                            td align="left" class="DropDownLook"&lt;br /&gt;                                img id="imgShowHide" runat="server" src="drop.gif" onclick="ShowMList()" align="left" /                &lt;br /&gt;                            /td&lt;br /&gt;                        /tr&lt;br /&gt;                        tr&lt;br /&gt;                            td colspan="2" class="DropDownLook"&lt;br /&gt;                                div&lt;br /&gt;                                 div runat="server" id="divCheckBoxListClose" class="DivClose"                           &lt;br /&gt;                                  label runat="server" onclick="HideMList();" class="LabelClose" id="lblClose"  x /label&lt;br /&gt;                              /div&lt;br /&gt;                                    div runat="server" id="divCheckBoxList" class="DivCheckBoxList"&lt;br /&gt;                                  asp:CheckBoxList ID="lstMultipleValues" runat="server" Width="250px" CssClass="CheckBoxList" /asp:CheckBoxList                                       &lt;br /&gt;                              /div&lt;br /&gt;                          /div&lt;br /&gt;                            /td&lt;br /&gt;                        /tr&lt;br /&gt;                    /table&lt;br /&gt;                /div&lt;br /&gt;                div&lt;br /&gt;                    asp:Button ID="btnSubmit" runat="server" Text="Submit Selection" OnClick="btnSubmit_Click" / &lt;br /&gt;                    asp:Label ID="lblTextSelected" runat="server" Text="" Font-Bold="true" &gt;/asp:Label&lt;br /&gt;                /div&lt;br /&gt;            /ContentTemplate&lt;br /&gt;        /asp:UpdatePanel&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4570388358056942020-789773023673485740?l=deiva-apk.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://deiva-apk.blogspot.com/feeds/789773023673485740/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4570388358056942020&amp;postID=789773023673485740' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4570388358056942020/posts/default/789773023673485740'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4570388358056942020/posts/default/789773023673485740'/><link rel='alternate' type='text/html' href='http://deiva-apk.blogspot.com/2008/12/multiselectdropdownlist.html' title='&lt;strong&gt;MultiSelectDropDownList&lt;/strong&gt;'/><author><name>Deiva</name><uri>http://www.blogger.com/profile/01579444991016554353</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://2.bp.blogspot.com/_yOUXlZCsLwo/SijGXeEKTcI/AAAAAAAAAC4/wZCfvpFCaTQ/S220/IMG_2074.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_yOUXlZCsLwo/STPFd_I4olI/AAAAAAAAACs/1VN-FIjqro4/s72-c/drop.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4570388358056942020.post-5907390864626549047</id><published>2008-12-01T14:24:00.003+05:30</published><updated>2008-12-01T14:30:14.106+05:30</updated><title type='text'>Understanding Identity Columns</title><content type='html'>How can I reset an Identity column and not start where it left?" I've been getting quite a few questions about identity columns lately. This article should cover everything I know about them. I'll cover creating them, populating them, resetting them and a few other goodies. (This article has been updated through SQL Server 2005.)&lt;br /&gt;&lt;br /&gt;Creating an Identity Column&lt;br /&gt;&lt;br /&gt;In it's simplest form an identity column creates a numeric sequence for you. You can specify a column as an identity in the CREATE TABLE statement:&lt;br /&gt;&lt;br /&gt;CREATE TABLE dbo.Yaks ( YakID smallint identity(7,2), YakName char(20) )&lt;br /&gt;The identity clause specifies that the column YakID is going to be an identity column. The first record added will automatically be assigned a value of 7 (the seed) and each subsequent record will be assigned a value 2 higher (the increment) than the previous inserted row. Most identity columns I see are specified as IDENTITY(1,1) but I used IDENTITY(7,2) so the difference would be clear. If you don't specify the identity and seed they both default to 1. Identity columns can be int, bigint, smallint, tinyint, or decimal or numeric with a scale of 0 (i.e. no places to the right of the decimal).&lt;br /&gt;&lt;br /&gt;Populating the Table&lt;br /&gt;&lt;br /&gt;When you insert into a table with an identity column you don't put a value into the identity column.&lt;br /&gt;&lt;br /&gt;INSERT INTO dbo.Yaks (YakName) values ('Gertrude')&lt;br /&gt;INSERT INTO dbo.Yaks (YakName) values ('Helga')&lt;br /&gt;&lt;br /&gt;SELECT YakID, YakName&lt;br /&gt;FROM dbo.Yaks&lt;br /&gt;&lt;br /&gt;- - - - - - - - - - - - - - - - - - - - - - - - &lt;br /&gt;&lt;br /&gt;YakID  YakName              &lt;br /&gt;------ -------------------- &lt;br /&gt;7      Gertrude            &lt;br /&gt;9      Helga&lt;br /&gt;The value for YakID was automatically filled in. If you do try to fill in a value for an identity column it will give you an error:&lt;br /&gt;&lt;br /&gt;INSERT INTO dbo.Yaks (YakID, YakName) values (5, 'Sam')&lt;br /&gt;&lt;br /&gt;- - - - - - - - - - - - - - - - - - - - - - - - &lt;br /&gt;&lt;br /&gt;Server: Msg 544, Level 16, State 1, Line 1&lt;br /&gt;Cannot insert explicit value for identity column in table 'Yaks' when IDENTITY_INSERT is set to OFF.&lt;br /&gt;Finding the Identity Value that was Inserted&lt;br /&gt;&lt;br /&gt;If you want to see what identity value was just inserted you can use @@IDENTITY.&lt;br /&gt;&lt;br /&gt;INSERT INTO dbo.Yaks (YakName) values ('Sam the Yak')&lt;br /&gt;SELECT SCOPE_IDENTITY() as NewRec&lt;br /&gt;&lt;br /&gt;- - - - - - - - - - - - - - - - - - - - - - - - &lt;br /&gt;&lt;br /&gt;NewRec&lt;br /&gt;----------------&lt;br /&gt;11&lt;br /&gt;Older applications might use @@IDENTITY to return the last identity value inserted. If you use @@IDENTITY and insert into a table that runs a trigger and generates another identity value, you will get back the last value generated in any table. That's why you use SCOPE_IDENTITY to return the inserted value. Every procedure, trigger, function and batch is it's own scope. SCOPE_IDENTITY shows the most recently inserted IDENTITY in the current scope (which ignores any triggers that might fire). SCOPE_IDENTITY is only available in SQL Server 2000 and higher. You can also see the most recent identity value for a table regardless of scope or session (process). You can use IDENT_CURRENT for that (again, SQL Server 2000 and higher only).&lt;br /&gt;&lt;br /&gt;SELECT IDENT_CURRENT('Yaks') as SameRecordAgain&lt;br /&gt;&lt;br /&gt;- - - - - - - - - - - - - - - - - - - - - - - - &lt;br /&gt;&lt;br /&gt;SameRecordAgain&lt;br /&gt;----------------&lt;br /&gt;11&lt;br /&gt;Notice that we had to pass in the table name to the IDENT_CURRENT function. This will give you the most recent identity value for that table regardless of who inserted it.&lt;br /&gt;&lt;br /&gt;Inserting Explicit Values into an Identity Column&lt;br /&gt;&lt;br /&gt;If you want to insert a value into an identity column you can use the SET IDENTITY_INSERT statement.&lt;br /&gt;&lt;br /&gt;SET IDENTITY_INSERT Yaks ON&lt;br /&gt;INSERT INTO dbo.Yaks (YakID, YakName) Values(1, 'Mac the Yak')&lt;br /&gt;SET IDENTITY_INSERT Yaks OFF&lt;br /&gt;SELECT * from yaks&lt;br /&gt;&lt;br /&gt;- - - - - - - - - - - - - - - - - - - - - - - - &lt;br /&gt;&lt;br /&gt;YakID  YakName              &lt;br /&gt;------ -------------------- &lt;br /&gt;7      Gertrude            &lt;br /&gt;9      Helga               &lt;br /&gt;11     Sam the Yak         &lt;br /&gt;1      Mac the Yak&lt;br /&gt;You can only turn on IDENTITY_INSERT for one table per session so it's always a good idea to turn it off when you're done with it.&lt;br /&gt;&lt;br /&gt;Deleting rows from a table with an Identity Column&lt;br /&gt;&lt;br /&gt;If you delete all the records from a table it won't reset the identity.&lt;br /&gt;&lt;br /&gt;DELETE FROM dbo.Yaks&lt;br /&gt;INSERT INTO dbo.Yaks (YakName) Values ('New Herd')&lt;br /&gt;SELECT SCOPE_IDENTITY()&lt;br /&gt;returns the inserted identity as 13. To reset the identity seed you need to use a DBCC command.&lt;br /&gt;&lt;br /&gt;DELETE FROM dbo.Yaks&lt;br /&gt;DBCC CHECKIDENT('Yaks', RESEED, 7)&lt;br /&gt;INSERT INTO dbo.Yaks (YakName) Values ('New Herd')&lt;br /&gt;SELECT SCOPE_IDENTITY()&lt;br /&gt;This returns an identity of 9. After the seed value is reset to 7, it's incremented by 2 (as we specified when we created the table) for the next record. Which also FINALLY answered Karla's question. You can also run DBCC CHECKIDENT without specifying a reseed value. If the current seed is lower than the highest value in the table, the seed is updated to the highest value in the table.&lt;br /&gt;&lt;br /&gt;SQL Server makes no attempt to guarantee sequential gap-free values in identity columns. If records are deleted SQL Server won't go back and populate using those values. It's also possible for an insert to fail and "use up" an identity value. Books Online has additional detailed information about identity columns.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4570388358056942020-5907390864626549047?l=deiva-apk.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://deiva-apk.blogspot.com/feeds/5907390864626549047/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4570388358056942020&amp;postID=5907390864626549047' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4570388358056942020/posts/default/5907390864626549047'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4570388358056942020/posts/default/5907390864626549047'/><link rel='alternate' type='text/html' href='http://deiva-apk.blogspot.com/2008/12/understanding-identity-columns.html' title='&lt;strong&gt;Understanding Identity Columns&lt;/strong&gt;'/><author><name>Deiva</name><uri>http://www.blogger.com/profile/01579444991016554353</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://2.bp.blogspot.com/_yOUXlZCsLwo/SijGXeEKTcI/AAAAAAAAAC4/wZCfvpFCaTQ/S220/IMG_2074.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4570388358056942020.post-991223904859528637</id><published>2008-12-01T10:08:00.001+05:30</published><updated>2008-12-01T10:08:56.095+05:30</updated><title type='text'>C# 2.0 Anonymous Methods</title><content type='html'>C# 2.0 provides a new feature called Anonymous Methods, which allow you to create inline un-named ( i.e. anonymous ) methods in your code, which can help increase the readability and maintainability of your applications by keeping the caller of the method and the method itself as close to one another as possible. This is akin to the best practice of keeping the declaration of a variable, for example, as close to the code that uses it.&lt;br /&gt;&lt;br /&gt;Here is a simple example of using an anonymous method to find all the even integers from 1...10:&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;private int[] _integers =&lt;br /&gt;      { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };&lt;br /&gt;&lt;br /&gt;int[] evenIntegers = Array.FindAll(_integers,&lt;br /&gt;                           delegate(int integer)&lt;br /&gt;                           {&lt;br /&gt;                               return (integer%2 == 0);&lt;br /&gt;                           }&lt;br /&gt;    );&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;The Anonymous Method is:&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;delegate(int integer)&lt;br /&gt;    {&lt;br /&gt;        return (integer%2 == 0);&lt;br /&gt;    }&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;which is called for each integer in the array and returns either true or false depending on if the integer is even.&lt;br /&gt;&lt;br /&gt;If you don't use an anonymous method, you will need to create a separate method as such:&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;private int[] _integers = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };&lt;br /&gt;&lt;br /&gt;int[] evenIntegers = Array.FindAll(_integers, IsEven);&lt;br /&gt;&lt;br /&gt;private bool IsEven(int integer)&lt;br /&gt;{&lt;br /&gt;    return (integer%2 == 0);&lt;br /&gt;}&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;When you have very simple methods like above that won't be reused, I find it much more elegant and meaningful to use anonymous methods. The code stays closer together which makes it easier to follow and maintain.&lt;br /&gt;&lt;br /&gt;Here is an example that uses an anonymous method to get the list of cities in a state selected in a DropDownList ( called States ):&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;List&lt;City&gt; citiesInFlorida =&lt;br /&gt;cities.FindAll(delegate(City city)&lt;br /&gt;     {&lt;br /&gt;         return city.State.Name.Equals(States.SelectedValue);&lt;br /&gt;     }&lt;br /&gt;);&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;You can also use anonymous methods as such:&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;button1.Click +=&lt;br /&gt;&lt;br /&gt;    delegate&lt;br /&gt;        {&lt;br /&gt;            MessageBox.Show("Hello");&lt;br /&gt;        };&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;which for such a simple operation doesn't “deserve“ a separate method to handle the event.&lt;br /&gt;&lt;br /&gt;Other uses of anonymous methods would be for asynchronous callback methods, etc.&lt;br /&gt;&lt;br /&gt;Anonymous methods don't have the cool factor of Generics, but they do offer a more expressive in-line approach to creating methods that can make your code easier to follow and maintain.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4570388358056942020-991223904859528637?l=deiva-apk.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://deiva-apk.blogspot.com/feeds/991223904859528637/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4570388358056942020&amp;postID=991223904859528637' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4570388358056942020/posts/default/991223904859528637'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4570388358056942020/posts/default/991223904859528637'/><link rel='alternate' type='text/html' href='http://deiva-apk.blogspot.com/2008/12/c-20-anonymous-methods.html' title='&lt;strong&gt;C# 2.0 Anonymous Methods&lt;/strong&gt;'/><author><name>Deiva</name><uri>http://www.blogger.com/profile/01579444991016554353</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://2.bp.blogspot.com/_yOUXlZCsLwo/SijGXeEKTcI/AAAAAAAAAC4/wZCfvpFCaTQ/S220/IMG_2074.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4570388358056942020.post-7618705487858903455</id><published>2008-11-30T09:17:00.000+05:30</published><updated>2008-11-30T09:18:47.266+05:30</updated><title type='text'>Maximum Capacity Specifications for SQL Server 2005</title><content type='html'># Batch size : -&gt; 65,536 * Network Packet Size&lt;br /&gt;# Bytes per short string column : -&gt; 8000&lt;br /&gt;# Bytes per text, ntext, image, varchar(max), nvarchar(max), varbinary(max), or XML column : -&gt; 231 -1 bytes/p&gt;&lt;br /&gt;# Bytes per GROUP BY, ORDER BY : -&gt; 8060&lt;br /&gt;# Bytes per index : -&gt; 900&lt;br /&gt;# Bytes per foreign key : -&gt; 900&lt;br /&gt;# Bytes per primary key : -&gt; 900&lt;br /&gt;# Bytes per row : -&gt; 8060&lt;br /&gt;# Bytes in source text of a stored procedure : -&gt; Lesser of batch size or 250 MB&lt;br /&gt;# Clustered indexes per table : -&gt; 1&lt;br /&gt;# Columns in GROUP BY, ORDER BY : -&gt; Limited only by number of bytes&lt;br /&gt;# Columns or expressions in a GROUP BY WITH CUBE or WITH ROLLUP statement : -&gt; 10&lt;br /&gt;# Columns per index : -&gt; 16&lt;br /&gt;# Columns per foreign key : -&gt; 16&lt;br /&gt;# Columns per primary key : -&gt; 16&lt;br /&gt;# Columns per base table : -&gt; 1024&lt;br /&gt;# Columns per SELECT statement : -&gt; 4096&lt;br /&gt;# Columns per INSERT statement : -&gt; 1024&lt;br /&gt;# Connections per client : -&gt; Maximum value of configured connections&lt;br /&gt;# Database size : -&gt; 1,048,516 terabytes&lt;br /&gt;# Databases per instance of SQL Server : -&gt; 32767&lt;br /&gt;# Filegroups per database : -&gt; 32767&lt;br /&gt;# Files per database : -&gt; 32767&lt;br /&gt;# File size (data) : -&gt; 32 terabytes&lt;br /&gt;# File size (log) : -&gt; 32 terabytes&lt;br /&gt;# Foreign key table references per table : -&gt; 253&lt;br /&gt;# Identifier length (in characters) : -&gt; 128&lt;br /&gt;# Instances per computer : -&gt; 50&lt;br /&gt;# Length of a string containing SQL statements (batch size) : -&gt; 65,536 * Network packet size&lt;br /&gt;# Locks per connection : -&gt; Maximum locks per server&lt;br /&gt;# Locks per instance of SQL Server : -&gt; Up to 2,147,483,647&lt;br /&gt;# Nested stored procedure levels : -&gt; 32&lt;br /&gt;# Nested subqueries : -&gt; 32&lt;br /&gt;# Nested trigger levels : -&gt; 32&lt;br /&gt;# Nonclustered indexes per table : -&gt; 249&lt;br /&gt;# Objects concurrently open in an instance of SQL Server : -&gt; 2,147,483,647 per database (depending on available memory)&lt;br /&gt;# Objects in a database : -&gt; 2147483647&lt;br /&gt;# Parameters per stored procedure : -&gt; 2100&lt;br /&gt;# Parameters per user-defined function : -&gt; 2100&lt;br /&gt;# REFERENCES per table : -&gt; 253&lt;br /&gt;# Rows per table : -&gt; Limited by available storage&lt;br /&gt;# Tables per database : -&gt; Limited by number of objects in a database&lt;br /&gt;# Tables per SELECT statement : -&gt; 256&lt;br /&gt;# Triggers per table : -&gt; Limited by number of objects in a database&lt;br /&gt;# UNIQUE indexes or constraints per table : -&gt; 249 nonclustered and 1 clustered&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4570388358056942020-7618705487858903455?l=deiva-apk.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://deiva-apk.blogspot.com/feeds/7618705487858903455/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4570388358056942020&amp;postID=7618705487858903455' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4570388358056942020/posts/default/7618705487858903455'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4570388358056942020/posts/default/7618705487858903455'/><link rel='alternate' type='text/html' href='http://deiva-apk.blogspot.com/2008/11/maximum-capacity-specifications-for-sql.html' title='Maximum Capacity Specifications for SQL Server 2005'/><author><name>Deiva</name><uri>http://www.blogger.com/profile/01579444991016554353</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://2.bp.blogspot.com/_yOUXlZCsLwo/SijGXeEKTcI/AAAAAAAAAC4/wZCfvpFCaTQ/S220/IMG_2074.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4570388358056942020.post-7140614816739391218</id><published>2008-11-28T11:21:00.003+05:30</published><updated>2008-11-28T11:30:35.747+05:30</updated><title type='text'>OOPS Concepts:</title><content type='html'>1) &lt;strong&gt;Encapsulation:&lt;/strong&gt; Wrapping up of data and methods in to a&lt;br /&gt;single unit is called as encapsulation.&lt;strong&gt;&lt;br /&gt;Protecting our data&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;2) &lt;strong&gt;Abstraction:&lt;/strong&gt; Hidding our irrelavance data&lt;br /&gt;&lt;br /&gt;3) &lt;strong&gt;Inheritence:&lt;/strong&gt; Process of Aquiring properties from one&lt;br /&gt;object to another without changes.&lt;br /&gt;&lt;br /&gt;4) &lt;strong&gt;Polymorphism:&lt;/strong&gt; Process of aquiring properies from one&lt;br /&gt;object to anotherwith changes.&lt;strong&gt;Different behaviors at diff. instances&lt;/strong&gt;&lt;br /&gt;There are two types of polymorphisms.&lt;br /&gt;    i)&lt;strong&gt;Compile-time polymorphism:&lt;/strong&gt;what object will be assigned to&lt;br /&gt;the present variable.This will be evaluated at compile time.&lt;br /&gt;This is known as compile-time polymorphism.&lt;br /&gt;   ii)&lt;strong&gt;Run-time polymorphism:&lt;/strong&gt;what object will be assigned to the&lt;br /&gt;present variable.This will be evaluated at runtime depending&lt;br /&gt;on condition.This is known as Run-time polymorphism.&lt;br /&gt;&lt;br /&gt;5) &lt;strong&gt;Message Passing:&lt;/strong&gt;message passing is possible from one&lt;br /&gt;object to another.&lt;br /&gt;&lt;br /&gt;6) &lt;strong&gt;Robust and Secure:&lt;/strong&gt; every object is strong one.         &lt;br /&gt;every object is secure one with their access specifiers.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;em&gt;&lt;strong&gt;Abstract, Sealed, and Static Modifiers in C#.&lt;/strong&gt;&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;C# provides many modifiers for use with types and type members. Of these, three can be used with classes: abstract, sealed and static. &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;abstract&lt;/strong&gt;&lt;br /&gt;Indicates that a class is to be used only as a base class for other classes. This means that you cannot create an instance of the class directly. Any class derived from it must implement all of its abstract methods and accessors. Despite its name, an abstract class can possess non-abstract methods and properties. &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;sealed&lt;/strong&gt;&lt;br /&gt;Specifies that a class cannot be inherited (used as a base class). Note that .NET does not permit a class to be both abstract and sealed. &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;static&lt;/strong&gt;&lt;br /&gt;Specifies that a class contains only static members (.NET 2.0). &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;em&gt;Virtual keyword&lt;/em&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;The virtual keyword allows polymorphism too. A virtual property or method has an implementation in the base class, and can be overriden in the derived classes.&lt;br /&gt;&lt;br /&gt;To create a virtual member in C#, use the virtual keyword:&lt;br /&gt;&lt;br /&gt;public virtual void Draw()&lt;br /&gt;&lt;br /&gt;To create a virtual member in VB.NET, use the Overridable keyword:&lt;br /&gt;&lt;br /&gt;Public Overridable Function Draw()&lt;br /&gt;&lt;br /&gt;&lt;em&gt;&lt;strong&gt;Override keyword&lt;/strong&gt;&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;Overriding is the action of modifying or replacing the implementation of the parent class with a new one. Parent classes with virtual or abstract members allow derived classes to override them.&lt;br /&gt;&lt;br /&gt;To override a member in C#, use the override keyword:&lt;br /&gt;&lt;br /&gt;public override void CalculateArea()&lt;br /&gt;&lt;br /&gt;To override a member in VB.NET, use the Overrides keyword:&lt;br /&gt;&lt;br /&gt;Public Overrides Function CalculateArea()&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;em&gt;What's the difference between override and new in C#?&lt;/em&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;This is all to do with polymorphism. When a virtual method is called on a reference, the actual type of the object that the reference refers to is used to decide which method implementation to use. When a method of a base class is overridden in a derived class, the version in the derived class is used, even if the calling code didn't "know" that the object was an instance of the derived class. For instance:&lt;br /&gt;public class Base&lt;br /&gt;{&lt;br /&gt;    public virtual void SomeMethod()&lt;br /&gt;    {&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public class Derived : Base&lt;br /&gt;{&lt;br /&gt;    public override void SomeMethod()&lt;br /&gt;    {&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;...&lt;br /&gt;&lt;br /&gt;Base b = new Derived();&lt;br /&gt;b.SomeMethod();&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;will end up calling Derived.SomeMethod if that overrides Base.SomeMethod. &lt;br /&gt;&lt;br /&gt;Now, if you use the new keyword instead of override, the method in the derived class doesn't override the method in the base class, it merely hides it. In that case, code like this:&lt;br /&gt;public class Base&lt;br /&gt;{&lt;br /&gt;    public virtual void SomeOtherMethod()&lt;br /&gt;    {&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public class Derived : Base&lt;br /&gt;{&lt;br /&gt;    public new void SomeOtherMethod()&lt;br /&gt;    {&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;...&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Base b = new Derived();&lt;br /&gt;Derived d = new Derived();&lt;br /&gt;b.SomeOtherMethod();&lt;br /&gt;d.SomeOtherMethod();&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;Will first call Base.SomeOtherMethod , then Derived.SomeOtherMethod . They're effectively two entirely separate methods which happen to have the same name, rather than the derived method overriding the base method. &lt;br /&gt;&lt;br /&gt;If you don't specify either new or overrides, the resulting output is the same as if you specified new, but you'll also get a compiler warning (as you may not be aware that you're hiding a method in the base class method, or indeed you may have wanted to override it, and merely forgot to include the keyword).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4570388358056942020-7140614816739391218?l=deiva-apk.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://deiva-apk.blogspot.com/feeds/7140614816739391218/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4570388358056942020&amp;postID=7140614816739391218' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4570388358056942020/posts/default/7140614816739391218'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4570388358056942020/posts/default/7140614816739391218'/><link rel='alternate' type='text/html' href='http://deiva-apk.blogspot.com/2008/11/oops-concepts.html' title='&lt;em&gt;OOPS Concepts:&lt;/em&gt;'/><author><name>Deiva</name><uri>http://www.blogger.com/profile/01579444991016554353</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://2.bp.blogspot.com/_yOUXlZCsLwo/SijGXeEKTcI/AAAAAAAAAC4/wZCfvpFCaTQ/S220/IMG_2074.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4570388358056942020.post-8304884497842470097</id><published>2008-11-24T13:36:00.003+05:30</published><updated>2008-11-24T13:41:18.288+05:30</updated><title type='text'>GridView Search Revisited</title><content type='html'>&lt;strong&gt;in .aspx&lt;/strong&gt;&lt;br /&gt;    Enter Search Keyword: &lt;br /&gt;asp:TextBox ID="txtSearchBox" runat="server"&lt;br /&gt;asp:Button ID="Btn_Search" OnClick="Search" runat="server" Text="Search" /&gt;&lt;br /&gt;asp:GridView ID="gvProducts" runat="server"  AutoGenerateColumns="false"  AllowPaging="True" Font-Size="Large" OnPageIndexChanging="gvProducts_PageIndexChanging" PageSize="10"&gt;&lt;br /&gt;Columns&gt;&lt;br /&gt;asp:TemplateField HeaderText="Product Name"&gt;&lt;br /&gt;ItemTemplate&gt;    &lt;br /&gt;asp:Label ID="lblProductName" runat="server" Text = '&lt;%# SearchKeyWord(  searchWord,(string) Eval("ProductName") ) %&gt;' /&gt;    &lt;br /&gt;/ItemTemplate&gt;    &lt;br /&gt;/asp:TemplateField&gt;&lt;br /&gt;/Columns&gt;&lt;br /&gt;/asp:GridView&gt;&lt;br /&gt;asp:Panel ID="Panel1" runat="server" Height="50px" Width="263px"&gt;&lt;br /&gt;&lt;/asp:Panel&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;.cs&lt;/strong&gt;&lt;br /&gt;using System;&lt;br /&gt;using System.Data;&lt;br /&gt;using System.Configuration;&lt;br /&gt;using System.Collections;&lt;br /&gt;using System.Web;&lt;br /&gt;using System.Web.Security;&lt;br /&gt;using System.Web.UI;&lt;br /&gt;using System.Web.UI.WebControls;&lt;br /&gt;using System.Web.UI.WebControls.WebParts;&lt;br /&gt;using System.Web.UI.HtmlControls;&lt;br /&gt;using System.Data.SqlClient;&lt;br /&gt;using System.Text.RegularExpressions;&lt;br /&gt;&lt;br /&gt;public partial class _Default : System.Web.UI.Page&lt;br /&gt;{&lt;br /&gt;    protected string searchWord = String.Empty;   &lt;br /&gt;    private const int PAGE_SIZE = 10;&lt;br /&gt;&lt;br /&gt;    private Hashtable hMatches = new Hashtable();   &lt;br /&gt;    &lt;br /&gt;    protected void Page_Load(object sender, EventArgs e)&lt;br /&gt;    {&lt;br /&gt;        if (!Page.IsPostBack)&lt;br /&gt;        {&lt;br /&gt;            BindData();    &lt;br /&gt;        }       &lt;br /&gt;&lt;br /&gt;        CreateLinks(); &lt;br /&gt;       &lt;br /&gt;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    private void CreateLinks()&lt;br /&gt;    {&lt;br /&gt;        Hashtable myHashTable = ViewState["MyHashTable"] as Hashtable; &lt;br /&gt;&lt;br /&gt;        if(myHashTable != null &amp;&amp; myHashTable.Count &gt; 0) &lt;br /&gt;        {&lt;br /&gt;&lt;br /&gt;        foreach (object key in new ArrayList(myHashTable.Keys))&lt;br /&gt;        {&lt;br /&gt;            LinkButton link = new LinkButton();&lt;br /&gt;            link.Command += new CommandEventHandler(link_Command);&lt;br /&gt;            link.CommandArgument = key.ToString();&lt;br /&gt;            link.Text = String.Format("There are {0} results on page {1}",myHashTable[key].ToString() , (Convert.ToInt32(key) + 1).ToString()) + "&lt;BR&gt;";&lt;br /&gt;                                   &lt;br /&gt;            Panel1.Controls.Add(link);&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        Panel1.DataBind();&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    private void BindData()&lt;br /&gt;    {&lt;br /&gt;        string connectionString = @"Server=CB-36A\SQLEXPRESS;Database=master;Trusted_Connection=true";&lt;br /&gt;        SqlConnection myConnection = new SqlConnection(connectionString);&lt;br /&gt;        SqlDataAdapter ad = new SqlDataAdapter("SELECT ProductName FROM Product", myConnection);&lt;br /&gt;&lt;br /&gt;        DataSet ds = new DataSet();&lt;br /&gt;        ad.Fill(ds);&lt;br /&gt;&lt;br /&gt;        gvProducts.DataSource = ds;&lt;br /&gt;        gvProducts.DataBind(); &lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    protected void Search(object sender, EventArgs e)&lt;br /&gt;    {&lt;br /&gt;        // clear the old results &lt;br /&gt;        Panel1.Controls.Clear();&lt;br /&gt;        Panel1.DataBind(); &lt;br /&gt;        &lt;br /&gt;        searchWord = txtSearchBox.Text;&lt;br /&gt;        SearchContainer(searchWord);      &lt;br /&gt;&lt;br /&gt;        // Hmmm  &lt;br /&gt;        BindData();      &lt;br /&gt;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    protected string SearchKeyWord(string searchString, string text)&lt;br /&gt;    {&lt;br /&gt;        Regex reg = new Regex(searchString.Replace(" ", "|"), RegexOptions.IgnoreCase);&lt;br /&gt;        return reg.Replace(text,new MatchEvaluator(ReplaceKeyWords));   &lt;br /&gt;        &lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    private void SearchContainer(string searchString)&lt;br /&gt;    {&lt;br /&gt;        int index = 0;        &lt;br /&gt;&lt;br /&gt;        // get the container&lt;br /&gt;        DataSet ds = GetDataSet(); &lt;br /&gt;       &lt;br /&gt;&lt;br /&gt;        double pageIndex = 0; &lt;br /&gt;&lt;br /&gt;        Regex reg = new Regex(searchString.Replace(" ","|"),RegexOptions.IgnoreCase); &lt;br /&gt;&lt;br /&gt;        foreach(DataRow row in ds.Tables[0].Rows) &lt;br /&gt;        {&lt;br /&gt;            if (reg.IsMatch(row["ProductName"] as String))&lt;br /&gt;            {&lt;br /&gt;                pageIndex = Math.Ceiling( Convert.ToDouble( index / PAGE_SIZE ));&lt;br /&gt;&lt;br /&gt;                if (hMatches.ContainsKey(pageIndex))&lt;br /&gt;                {&lt;br /&gt;                    hMatches[pageIndex] = ((int)hMatches[pageIndex]) + 1;&lt;br /&gt;                }&lt;br /&gt;                else&lt;br /&gt;                {&lt;br /&gt;                    hMatches.Add(pageIndex, 1); &lt;br /&gt;                }               &lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            index++; &lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        ViewState["MyHashTable"] = hMatches;&lt;br /&gt;&lt;br /&gt;        CreateLinks(); &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    void link_Command(object sender, CommandEventArgs e)&lt;br /&gt;    {&lt;br /&gt;        gvProducts.PageIndex = Convert.ToInt32( e.CommandArgument);&lt;br /&gt;        searchWord = txtSearchBox.Text;&lt;br /&gt;        BindData(); &lt;br /&gt;    }   &lt;br /&gt;&lt;br /&gt;    private DataSet GetDataSet()&lt;br /&gt;    {&lt;br /&gt;        string connectionString = @"Server=CB-36A\SQLEXPRESS;Database=master;Trusted_Connection=true";&lt;br /&gt;        SqlConnection myConnection = new SqlConnection(connectionString);&lt;br /&gt;        SqlDataAdapter ad = new SqlDataAdapter("SELECT ProductName FROM Product", myConnection);&lt;br /&gt;&lt;br /&gt;        DataSet ds = new DataSet();&lt;br /&gt;&lt;br /&gt;        ad.Fill(ds); &lt;br /&gt;&lt;br /&gt;        return ds; &lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    private string ReplaceKeyWords(Match m)&lt;br /&gt;    {&lt;br /&gt;        return "&lt;span class='highlight'&gt;" + m.Value + "&lt;/span&gt;"; &lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    protected void gvProducts_PageIndexChanging(object sender, GridViewPageEventArgs e)&lt;br /&gt;    {&lt;br /&gt;        gvProducts.PageIndex = e.NewPageIndex;&lt;br /&gt;        searchWord = txtSearchBox.Text;&lt;br /&gt;        BindData(); &lt;br /&gt;    }   &lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4570388358056942020-8304884497842470097?l=deiva-apk.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://deiva-apk.blogspot.com/feeds/8304884497842470097/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4570388358056942020&amp;postID=8304884497842470097' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4570388358056942020/posts/default/8304884497842470097'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4570388358056942020/posts/default/8304884497842470097'/><link rel='alternate' type='text/html' href='http://deiva-apk.blogspot.com/2008/11/gridview-search-revisited.html' title='GridView Search Revisited'/><author><name>Deiva</name><uri>http://www.blogger.com/profile/01579444991016554353</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://2.bp.blogspot.com/_yOUXlZCsLwo/SijGXeEKTcI/AAAAAAAAAC4/wZCfvpFCaTQ/S220/IMG_2074.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4570388358056942020.post-3154061240400367931</id><published>2008-11-20T16:47:00.001+05:30</published><updated>2008-11-20T16:50:59.800+05:30</updated><title type='text'>What is custom control? What is the difference between custom control and user control?</title><content type='html'>Custom controls are controls that are developed by the developer&lt;br /&gt;or a third party vendor. Custom controls are not provided along with &lt;br /&gt;.NET. &lt;br /&gt;&lt;br /&gt;Difference between Custom Controls and User Controls.&lt;br /&gt;&lt;br /&gt;1.User Control is a page file with extension .ascx which can only be used within&lt;br /&gt;a single application. But custom controls are assemblies(dll files) that can be &lt;br /&gt;used in multiple applications.&lt;br /&gt;&lt;br /&gt;2.User Controls cannot be added to the ToolBox of VS.NET . To use a user Control with in an&lt;br /&gt;aspx page u have to drag the user Control from the solution Explorer to designer page.&lt;br /&gt;But Custom Controls can be added to ToolBox of VS.NET.&lt;br /&gt;&lt;br /&gt;3.User Controls can be viewed as a sort of generic controls during the design time.&lt;br /&gt;The proper GUI of user controls can be viewed only during the run time.&lt;br /&gt;But Custom Controls can be viewed during the design time.&lt;br /&gt;&lt;br /&gt;4. User controls are created from existing Webserver and html server controls .&lt;br /&gt;But a developer who creates custom controls have to render every thing from the scratch.&lt;br /&gt;&lt;br /&gt;5.Since the dll assembly of a custom control is being used,a custom control developed in C# can be used in a project developed in VB.NET or any other managed code and vice versa.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;User Controls:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;1.Have an ascx extension.&lt;br /&gt;2.Are compiled at runtime when the page is loaded.&lt;br /&gt;3.Visual design is possible, just like an aspx page and uses the ASP.Net page model with code behind file.&lt;br /&gt;4.Can only be used on a host aspx page or another user control.&lt;br /&gt;5.Cannot be added to the ToolBox.&lt;br /&gt;6.Can only be used in the current web application (source must be copied to another application to use).&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Custom Server Control:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;1.Exist in precompiled assemblies.&lt;br /&gt;2.Code entirely contained in .cs (or .vb)&lt;br /&gt;3.No visual designer. Any HTML code needs to be declared programmatically.&lt;br /&gt;4.Can be used in .aspx pages, user controls or other custom server controls.&lt;br /&gt;5.Can be added to the ToolBox (drag and drop)&lt;br /&gt;6.Can be shared between web applications.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4570388358056942020-3154061240400367931?l=deiva-apk.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://deiva-apk.blogspot.com/feeds/3154061240400367931/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4570388358056942020&amp;postID=3154061240400367931' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4570388358056942020/posts/default/3154061240400367931'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4570388358056942020/posts/default/3154061240400367931'/><link rel='alternate' type='text/html' href='http://deiva-apk.blogspot.com/2008/11/what-is-custom-control-what-is.html' title='What is custom control? What is the difference between custom control and user control?'/><author><name>Deiva</name><uri>http://www.blogger.com/profile/01579444991016554353</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://2.bp.blogspot.com/_yOUXlZCsLwo/SijGXeEKTcI/AAAAAAAAAC4/wZCfvpFCaTQ/S220/IMG_2074.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4570388358056942020.post-40569741033711434</id><published>2008-11-10T17:48:00.000+05:30</published><updated>2008-11-10T17:51:52.258+05:30</updated><title type='text'>Change GridView RowColor OnMouseClick</title><content type='html'>&lt;span style="font-weight:bold;"&gt;Introduction: &lt;/span&gt;&lt;br /&gt;In this article I will demonstrate that how you can change the color of the GridView row by using simple mouse click and change it back to its original color by clicking the row twice. &lt;br /&gt;&lt;span style="font-weight:bold;"&gt;The Row Created Event of the GridView:&lt;br /&gt;&lt;/span&gt;Like my last article "Changing GridView Row Color OnMouseOver" I used the same approach in populating the GridView. The difference lies in the RowCreated event of the GridView control. Take a look at the RowCreated event below to have a better idea: &lt;br /&gt;&lt;br /&gt;protected void MyGridView_RowCreated(object sender, GridViewRowEventArgs e)&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;string rowID = String.Empty; &lt;br /&gt;&lt;br /&gt;if (e.Row.RowType == DataControlRowType.DataRow)&lt;br /&gt;&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;rowID = "row"+e.Row.RowIndex; &lt;br /&gt;&lt;br /&gt;e.Row.Attributes.Add("id","row"+e.Row.RowIndex);&lt;br /&gt;&lt;br /&gt;e.Row.Attributes.Add("onclick","ChangeRowColor(" +"'" + rowID + "'" + ")");&lt;br /&gt;&lt;br /&gt;} &lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;As, you can see in the method above I am assigning different ids to the rows by embedding the id attribute. This will help me distinguish one row from the other. Later, on the onclick attribute I attach the Java Script function "ChangeRowColor" which is responsible for changing the color of the GridView row. The ChangeRowColor function takes in the id of the row. Let's take a look at the ChangeRowColor function. &lt;br /&gt;&lt;br /&gt;script language ="javascript" type="text/javascript"&lt;br /&gt;document.body.style.cursor = 'pointer'; &lt;br /&gt;&lt;br /&gt;var oldColor = '';&lt;br /&gt;function ChangeRowColor(rowID) &lt;br /&gt;{ &lt;br /&gt;var color = document.getElementById(rowID).style.backgroundColor;&lt;br /&gt;if(color != 'yellow') &lt;br /&gt;oldColor = color;&lt;br /&gt;if(color == 'yellow') &lt;br /&gt;document.getElementById(rowID).style.backgroundColor = oldColor;&lt;br /&gt;else document.getElementById(rowID).style.backgroundColor = 'yellow'; &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;/script&lt;br /&gt;&lt;br /&gt;The ChangeRowColor function takes in the id of the row and finds the color of the row. Then it checks that if the color is 'yellow' which, is the color of the highlight row. If it is not yellow then it simply assigns the color to the public variable oldColor which is used to save the previous color of the GridView row. If the color is yellow then we get the previous color and assign to the row so that it can come back to its original state.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4570388358056942020-40569741033711434?l=deiva-apk.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://deiva-apk.blogspot.com/feeds/40569741033711434/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4570388358056942020&amp;postID=40569741033711434' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4570388358056942020/posts/default/40569741033711434'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4570388358056942020/posts/default/40569741033711434'/><link rel='alternate' type='text/html' href='http://deiva-apk.blogspot.com/2008/11/change-gridview-rowcolor-onmouseclick.html' title='Change GridView RowColor OnMouseClick'/><author><name>Deiva</name><uri>http://www.blogger.com/profile/01579444991016554353</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://2.bp.blogspot.com/_yOUXlZCsLwo/SijGXeEKTcI/AAAAAAAAAC4/wZCfvpFCaTQ/S220/IMG_2074.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4570388358056942020.post-2627813184290901007</id><published>2008-11-10T17:36:00.000+05:30</published><updated>2008-11-10T17:47:15.076+05:30</updated><title type='text'>Searching Inside the GridView Control And Highlight</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_yOUXlZCsLwo/SRgmQip80cI/AAAAAAAAAB0/qQ6uhLr5ODM/s1600-h/GridViewSearch.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 206px; height: 320px;" src="http://1.bp.blogspot.com/_yOUXlZCsLwo/SRgmQip80cI/AAAAAAAAAB0/qQ6uhLr5ODM/s320/GridViewSearch.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5267001829832315330" /&gt;&lt;/a&gt;&lt;br /&gt;There was a post on ASP.NET forums where the user asked how to search inside the GridView control. I was managed to implement this feature although if you plan to use the following code then I would highly recommend that you refactor it as it lacks in performance. In my opinion since you are searching inside the GridView the whole procedure should be handled on the client side using JavaScript or VBScript. Anyhow the following code uses the server side button click event to parse the GridView and highlight the search fields. &lt;br /&gt;protected void Button1_Click(object sender, EventArgs e)&lt;br /&gt;{&lt;br /&gt;  string searchString = txtSearch.Text;&lt;br /&gt;  StringBuilder sb = new StringBuilder();&lt;br /&gt;  DataTable dt = new DataTable();&lt;br /&gt;  List&lt;GridViewRow&gt; rows = new List&lt;GridViewRow&gt;(); &lt;br /&gt;  foreach (GridViewRow row in GridView1.Rows)&lt;br /&gt;  {&lt;br /&gt;   TableCellCollection cells = row.Cells;&lt;br /&gt;   foreach (TableCell cell in cells)&lt;br /&gt;   {&lt;br /&gt;     if (cell.Text.ToLower().StartsWith(searchString.ToLower()))&lt;br /&gt;     {&lt;br /&gt;       cell.BackColor = System.Drawing.Color.Yellow;&lt;br /&gt;       foreach (TableCell c in cells)&lt;br /&gt;       {&lt;br /&gt;        sb.Append(c.Text);&lt;br /&gt;       }&lt;br /&gt;       sb.Append("&lt;BR&gt;"); &lt;br /&gt;     }&lt;br /&gt;     else&lt;br /&gt;     {&lt;br /&gt;       cell.BackColor = System.Drawing.Color.White;&lt;br /&gt;     }&lt;br /&gt;   }&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;The code above simply goes through the GridView row by row and cell by cell. And if it finds a string that starts with the searchString then it highlights it and append it in the StringBuilder object.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4570388358056942020-2627813184290901007?l=deiva-apk.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://deiva-apk.blogspot.com/feeds/2627813184290901007/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4570388358056942020&amp;postID=2627813184290901007' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4570388358056942020/posts/default/2627813184290901007'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4570388358056942020/posts/default/2627813184290901007'/><link rel='alternate' type='text/html' href='http://deiva-apk.blogspot.com/2008/11/searching-inside-gridview-control-and.html' title='Searching Inside the GridView Control And Highlight'/><author><name>Deiva</name><uri>http://www.blogger.com/profile/01579444991016554353</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://2.bp.blogspot.com/_yOUXlZCsLwo/SijGXeEKTcI/AAAAAAAAAC4/wZCfvpFCaTQ/S220/IMG_2074.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_yOUXlZCsLwo/SRgmQip80cI/AAAAAAAAAB0/qQ6uhLr5ODM/s72-c/GridViewSearch.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4570388358056942020.post-2966968903989129556</id><published>2008-09-26T12:47:00.001+05:30</published><updated>2008-09-26T12:47:36.892+05:30</updated><title type='text'>Difference Between User Defined functions And Stored Procedure</title><content type='html'>1&gt;Procedure can return zero or n values whereas function can return one value which is mandatory.&lt;br /&gt;&lt;br /&gt;2&gt;Procedures can have input,output parameters for it whereas functions can have only input parameters.&lt;br /&gt;&lt;br /&gt;3&gt;Procedure allow select as well as DML statement in it whereas function allow only select statement in it.&lt;br /&gt;&lt;br /&gt;4&gt;Functions can be called from procedure whereas procedures cannot be called from function.&lt;br /&gt;&lt;br /&gt;5&gt;Exception can be handled by try-catch block in a procedure whereas try-catch block cannot be used in a function.&lt;br /&gt;&lt;br /&gt;6&gt;We can go for transaction management in procedure whereas we can't go in function.&lt;br /&gt;&lt;br /&gt;7&gt;Procedures can not be utilized in a select statement whereas function can be embedded in a select statement.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4570388358056942020-2966968903989129556?l=deiva-apk.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://deiva-apk.blogspot.com/feeds/2966968903989129556/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4570388358056942020&amp;postID=2966968903989129556' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4570388358056942020/posts/default/2966968903989129556'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4570388358056942020/posts/default/2966968903989129556'/><link rel='alternate' type='text/html' href='http://deiva-apk.blogspot.com/2008/09/difference-between-user-defined.html' title='Difference Between User Defined functions And Stored Procedure'/><author><name>Deiva</name><uri>http://www.blogger.com/profile/01579444991016554353</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://2.bp.blogspot.com/_yOUXlZCsLwo/SijGXeEKTcI/AAAAAAAAAC4/wZCfvpFCaTQ/S220/IMG_2074.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4570388358056942020.post-3032582994651081337</id><published>2008-09-25T15:53:00.001+05:30</published><updated>2008-09-25T16:23:40.469+05:30</updated><title type='text'>DataList Custom Paging</title><content type='html'>&lt;a href="http://1.bp.blogspot.com/_yOUXlZCsLwo/SNtsrChXguI/AAAAAAAAABE/YxSYom4bc-E/s1600-h/Country.jpg"&gt;&lt;img style="cursor:pointer; cursor:hand;" src="http://1.bp.blogspot.com/_yOUXlZCsLwo/SNtsrChXguI/AAAAAAAAABE/YxSYom4bc-E/s320/Country.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5249909277297443554" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;.cs&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;using System;&lt;br /&gt;using System.Data;&lt;br /&gt;using System.Configuration;&lt;br /&gt;using System.Web;&lt;br /&gt;using System.Web.Security;&lt;br /&gt;using System.Web.UI;&lt;br /&gt;using System.Web.UI.WebControls;&lt;br /&gt;using System.Web.UI.WebControls.WebParts;&lt;br /&gt;using System.Web.UI.HtmlControls;&lt;br /&gt;using System.Data.Sql;&lt;br /&gt;using System.Data.SqlClient;&lt;br /&gt;&lt;br /&gt;public partial class _Default : System.Web.UI.Page &lt;br /&gt;{&lt;br /&gt;    PagedDataSource pds = new PagedDataSource();&lt;br /&gt;    DataTable dt = new DataTable();&lt;br /&gt;    static int lastPage = 0;&lt;br /&gt;    protected void Page_Load(object sender, EventArgs e)&lt;br /&gt;    {&lt;br /&gt;        if (!IsPostBack)&lt;br /&gt;        {&lt;br /&gt;            //lastPage = 0;&lt;br /&gt;            ddlPageSize.Items.Add("5");&lt;br /&gt;            ddlPageSize.Items.Add("10");&lt;br /&gt;            ddlPageSize.Items.Add("15");&lt;br /&gt;            BindGrid();&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;    private void BindGrid() &lt;br /&gt;    {&lt;br /&gt;            string connectionString = @"Data Source =CB-36A\SQLEXPRESS ;Initial Catalog=master;Integrated Security=True";&lt;br /&gt;            SqlConnection myConnection = new SqlConnection(connectionString);&lt;br /&gt;            SqlDataAdapter da = new SqlDataAdapter("SELECT * FROM Country", myConnection);&lt;br /&gt;            DataTable dt = new DataTable();&lt;br /&gt;            da.Fill(dt);&lt;br /&gt;            pds.DataSource = dt.DefaultView;&lt;br /&gt;            pds.AllowPaging = true;&lt;br /&gt;            pds.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);&lt;br /&gt;            pds.CurrentPageIndex = CurrentPage;&lt;br /&gt;            lnkbtnNext.Enabled = !pds.IsLastPage;&lt;br /&gt;            lnkbtnPrevious.Enabled = !pds.IsFirstPage;&lt;br /&gt;            lnkbtnFirst.Enabled = !pds.IsFirstPage;&lt;br /&gt;            lnkbtnLast.Enabled = !pds.IsLastPage;&lt;br /&gt;            Countrydlst.DataSource = pds;&lt;br /&gt;            Countrydlst.DataBind();&lt;br /&gt;            doPaging();&lt;br /&gt;    }&lt;br /&gt;    protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)&lt;br /&gt;    {&lt;br /&gt;        BindGrid();&lt;br /&gt;        doPaging();&lt;br /&gt;    }&lt;br /&gt;    public int CurrentPage&lt;br /&gt;    {&lt;br /&gt;        get&lt;br /&gt;        {&lt;br /&gt;            if (this.ViewState["CurrentPage"] == null)&lt;br /&gt;                return 0;&lt;br /&gt;            else&lt;br /&gt;                return Convert.ToInt16(this.ViewState["CurrentPage"].ToString());&lt;br /&gt;        }&lt;br /&gt;        set&lt;br /&gt;        {&lt;br /&gt;            this.ViewState["CurrentPage"] = value;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;    }&lt;br /&gt;    private void doPaging()&lt;br /&gt;    {&lt;br /&gt;        DataTable dt = new DataTable();&lt;br /&gt;        dt.Columns.Add("PageIndex");&lt;br /&gt;        dt.Columns.Add("PageText");&lt;br /&gt;        for (int i = 0; i &lt; pds.PageCount; i++)&lt;br /&gt;        {&lt;br /&gt;            DataRow dr = dt.NewRow();&lt;br /&gt;            dr[0] = i;&lt;br /&gt;            dr[1] = i + 1;&lt;br /&gt;            dt.Rows.Add(dr);&lt;br /&gt;        }&lt;br /&gt;        lastPage = int.Parse(dt.Rows[dt.Rows.Count - 1][0].ToString()); &lt;br /&gt;        Pagingdlst.DataSource = dt;&lt;br /&gt;        Pagingdlst.DataBind();&lt;br /&gt;    }&lt;br /&gt;    protected void Pagingdlst_ItemCommand(object source, DataListCommandEventArgs e)&lt;br /&gt;    {&lt;br /&gt;        if (e.CommandName.Equals("lnkbtnPaging"))&lt;br /&gt;        {&lt;br /&gt;            CurrentPage = Convert.ToInt16(e.CommandArgument.ToString());&lt;br /&gt;            BindGrid();&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;    protected void lnkbtnPrevious_Click(object sender, EventArgs e)&lt;br /&gt;    {&lt;br /&gt;        CurrentPage -= 1;&lt;br /&gt;        BindGrid();&lt;br /&gt;    }&lt;br /&gt;    protected void lnkbtnNext_Click(object sender, EventArgs e)&lt;br /&gt;    {&lt;br /&gt;        CurrentPage += 1;&lt;br /&gt;        BindGrid();&lt;br /&gt;    }&lt;br /&gt;    protected void Pagingdlst_SelectedIndexChanged(object sender, EventArgs e)&lt;br /&gt;    {&lt;br /&gt;        CurrentPage = 0;&lt;br /&gt;        BindGrid();   &lt;br /&gt;    }&lt;br /&gt;    protected void Pagingdlst_ItemDataBound(object sender, DataListItemEventArgs e)&lt;br /&gt;    {&lt;br /&gt;        LinkButton lnkbtnPage = (LinkButton)e.Item.FindControl("lnkbtnPaging");&lt;br /&gt;        if (lnkbtnPage.CommandArgument.ToString() == CurrentPage.ToString())&lt;br /&gt;        {&lt;br /&gt;            lnkbtnPage.Enabled = false;&lt;br /&gt;            lnkbtnPage.Font.Bold = true;&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;    protected void lnkbtnFirst_Click(object sender, EventArgs e)&lt;br /&gt;    {&lt;br /&gt;        CurrentPage = 0;&lt;br /&gt;        BindGrid();&lt;br /&gt;    }&lt;br /&gt;    protected void lnkbtnLast_Click(object sender, EventArgs e)&lt;br /&gt;    {&lt;br /&gt;        CurrentPage = lastPage;&lt;br /&gt;        BindGrid();&lt;br /&gt;    }&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4570388358056942020-3032582994651081337?l=deiva-apk.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://deiva-apk.blogspot.com/feeds/3032582994651081337/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4570388358056942020&amp;postID=3032582994651081337' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4570388358056942020/posts/default/3032582994651081337'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4570388358056942020/posts/default/3032582994651081337'/><link rel='alternate' type='text/html' href='http://deiva-apk.blogspot.com/2008/09/datalist-custom-paging.html' title='DataList Custom Paging'/><author><name>Deiva</name><uri>http://www.blogger.com/profile/01579444991016554353</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://2.bp.blogspot.com/_yOUXlZCsLwo/SijGXeEKTcI/AAAAAAAAAC4/wZCfvpFCaTQ/S220/IMG_2074.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_yOUXlZCsLwo/SNtsrChXguI/AAAAAAAAABE/YxSYom4bc-E/s72-c/Country.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4570388358056942020.post-4287553286448569216</id><published>2008-09-23T16:01:00.000+05:30</published><updated>2008-09-23T16:04:46.645+05:30</updated><title type='text'>How to Export the File in to Pdf, Doc and xls Using Crystal Report</title><content type='html'>using System;&lt;br /&gt;using System.Data;&lt;br /&gt;using System.Configuration;&lt;br /&gt;using System.Web;&lt;br /&gt;using System.Web.Security;&lt;br /&gt;using System.Web.UI;&lt;br /&gt;using System.Web.UI.WebControls;&lt;br /&gt;using System.Web.UI.WebControls.WebParts;&lt;br /&gt;using System.Web.UI.HtmlControls;&lt;br /&gt;using CrystalDecisions.Shared;&lt;br /&gt;using CrystalDecisions.CrystalReports.Engine;&lt;br /&gt;using CrystalDecisions.ReportSource;&lt;br /&gt;using System.IO;&lt;br /&gt;public partial class _Default : System.Web.UI.Page&lt;br /&gt;{&lt;br /&gt;//protected CrystalDecisions.Web.CrystalReportViewer CrystalReportViewer1;&lt;br /&gt;//protected System.Web.UI.WebControls.Button Button1;&lt;br /&gt;ReportDocument rDoc = new ReportDocument();&lt;br /&gt;protected void Page_Load(object sender, EventArgs e)&lt;br /&gt;{&lt;br /&gt;string FilePath = Server.MapPath("CrystalReport.rpt");&lt;br /&gt;rDoc.Load(FilePath);&lt;br /&gt;DataSet ds = new DataSet();&lt;br /&gt;CrystalReportViewer1.ReportSource = rDoc;&lt;br /&gt;CrystalReportViewer1.Visible = true;&lt;br /&gt;}&lt;br /&gt;protected void Button1_Click(object sender, EventArgs e)&lt;br /&gt;{&lt;br /&gt;MemoryStream oStream= new MemoryStream (); // using System.IO&lt;br /&gt;switch (DropDownList1.SelectedItem.Text )&lt;br /&gt;{&lt;br /&gt;case "Pdf":&lt;br /&gt;oStream = (MemoryStream)rDoc.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);&lt;br /&gt;Response.Clear();&lt;br /&gt;Response.Buffer = true;&lt;br /&gt;Response.ContentType = "application/pdf";&lt;br /&gt;Response.AddHeader("Content-Disposition", "attachment;filename=SearchResult.pdf");&lt;br /&gt;Response.BinaryWrite(oStream.ToArray());&lt;br /&gt;Response.End();&lt;br /&gt;break ;&lt;br /&gt;case "Doc":&lt;br /&gt;oStream = (MemoryStream)rDoc.ExportToStream(CrystalDecisions.Shared.ExportFormatType.WordForWindows);&lt;br /&gt;Response.Clear();&lt;br /&gt;Response.Buffer = true;&lt;br /&gt;Response.ContentType = "application/doc";&lt;br /&gt;Response.AddHeader("Content-Disposition", "attachment;filename=SearchResult.doc");&lt;br /&gt;Response.BinaryWrite(oStream.ToArray());&lt;br /&gt;Response.End();&lt;br /&gt;break;&lt;br /&gt;case "Excel":&lt;br /&gt;oStream = (MemoryStream)rDoc.ExportToStream(CrystalDecisions.Shared.ExportFormatType.Excel);&lt;br /&gt;Response.Clear();&lt;br /&gt;Response.Buffer = true;&lt;br /&gt;Response.ContentType = "application/vnd.ms-excel";&lt;br /&gt;Response.AddHeader("Content-Disposition", "attachment;filename=SearchResult.xls");&lt;br /&gt;Response.BinaryWrite(oStream.ToArray());&lt;br /&gt;Response.End();&lt;br /&gt;break;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4570388358056942020-4287553286448569216?l=deiva-apk.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://deiva-apk.blogspot.com/feeds/4287553286448569216/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4570388358056942020&amp;postID=4287553286448569216' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4570388358056942020/posts/default/4287553286448569216'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4570388358056942020/posts/default/4287553286448569216'/><link rel='alternate' type='text/html' href='http://deiva-apk.blogspot.com/2008/09/how-to-export-file-in-to-pdf-doc-and.html' title='How to Export the File in to Pdf, Doc and xls Using Crystal Report'/><author><name>Deiva</name><uri>http://www.blogger.com/profile/01579444991016554353</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://2.bp.blogspot.com/_yOUXlZCsLwo/SijGXeEKTcI/AAAAAAAAAC4/wZCfvpFCaTQ/S220/IMG_2074.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4570388358056942020.post-7648603646502268620</id><published>2008-09-16T16:47:00.000+05:30</published><updated>2008-09-16T17:07:42.234+05:30</updated><title type='text'>Insert, Update, Delete with Gridview....simple way using Stored Procedure</title><content type='html'>&lt;a href="http://2.bp.blogspot.com/_yOUXlZCsLwo/SM-aDceHP4I/AAAAAAAAAAo/HqkWqmlDCmU/s1600-h/4.gif"&gt;&lt;img id="BLOGGER_PHOTO_ID_5246581474882699138" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; CURSOR: hand" alt="" src="http://2.bp.blogspot.com/_yOUXlZCsLwo/SM-aDceHP4I/AAAAAAAAAAo/HqkWqmlDCmU/s320/4.gif" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div&gt;&lt;a href="http://3.bp.blogspot.com/_yOUXlZCsLwo/SM-Z_ZkgMlI/AAAAAAAAAAg/A2bpLRRbUoU/s1600-h/3.gif"&gt;&lt;img id="BLOGGER_PHOTO_ID_5246581405384716882" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; CURSOR: hand" alt="" src="http://3.bp.blogspot.com/_yOUXlZCsLwo/SM-Z_ZkgMlI/AAAAAAAAAAg/A2bpLRRbUoU/s320/3.gif" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;a href="http://1.bp.blogspot.com/_yOUXlZCsLwo/SM-Z6xCIOnI/AAAAAAAAAAY/vJRPmMPM4bk/s1600-h/2.gif"&gt;&lt;img id="BLOGGER_PHOTO_ID_5246581325783644786" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; CURSOR: hand" alt="" src="http://1.bp.blogspot.com/_yOUXlZCsLwo/SM-Z6xCIOnI/AAAAAAAAAAY/vJRPmMPM4bk/s320/2.gif" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;a href="http://4.bp.blogspot.com/_yOUXlZCsLwo/SM-Zt2KHbVI/AAAAAAAAAAQ/KNxilxW6d1w/s1600-h/1.gif"&gt;&lt;img id="BLOGGER_PHOTO_ID_5246581103821024594" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; CURSOR: hand" alt="" src="http://4.bp.blogspot.com/_yOUXlZCsLwo/SM-Zt2KHbVI/AAAAAAAAAAQ/KNxilxW6d1w/s320/1.gif" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;Introduction&lt;br /&gt;This is a simple way to display, Update, Delete and Insert through a single page.&lt;br /&gt;&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;Using the code&lt;br /&gt;Many of us may be encountered with Update and Delete operations with GridView. I’m explaining this with more functionality that is Inserting record through the GridView. There could me more way to achieve this functionality but I think it’s a very simple way to achieve this. I’m taking a very simple table named “quest_categories”&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;CREATE TABLE [dbo].[quest_categories](&lt;br /&gt;[cat_id] [int] IDENTITY(1,1) NOT NULL,&lt;br /&gt;[cat_name] [varchar](150) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,&lt;br /&gt;CONSTRAINT [PK_quest_categories] PRIMARY KEY CLUSTERED&lt;br /&gt;(&lt;br /&gt;[cat_id] ASC&lt;br /&gt;)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]&lt;br /&gt;) ON [PRIMARY]&lt;/div&gt;&lt;br /&gt;&lt;div&gt;Here is the Code for “Add Category”&lt;/div&gt;&lt;div&gt;protected void btnAdd_Click(object sender, EventArgs e)&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings\["exam_moduleConnectionString"].ConnectionString);&lt;/div&gt;&lt;div&gt;SqlDataAdapter da = new SqlDataAdapter("SELECT cat_id, cat_nameFROMquest_categories",con);&lt;/div&gt;&lt;div&gt;DataTable dt = new DataTable();&lt;/div&gt;&lt;div&gt;da.Fill(dt);&lt;br /&gt;// Here we'll add a blank row to the returned DataTableDataRow dr = dt.NewRow();dt.Rows.InsertAt(dr, 0);//Creating the first row of GridView to be EditableGridView1.EditIndex = 0;&lt;/div&gt;&lt;div&gt;GridView1.DataSource = dt;&lt;/div&gt;&lt;div&gt;GridView1.DataBind();//Changing the Text for Inserting a New Record((LinkButton)GridView1.Rows[0].Cells[0].Controls[0]).Text = "Insert";&lt;br /&gt;}&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;And according to Text Diplays we’ll do further processing as “Update” or “Insert” record.&lt;br /&gt;Here is the code for “RowUpdating” event.&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)&lt;br /&gt;{&lt;br /&gt;if (((LinkButton)GridView1.Rows[0].Cells[0].Controls[0]).Text == "Insert")&lt;br /&gt;{&lt;br /&gt;SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["exam_moduleConnectionString"].ConnectionString);&lt;br /&gt;SqlCommand cmd = new SqlCommand();&lt;br /&gt;cmd.CommandText = "INSERT INTO quest_categories(cat_name) VALUES(@cat_name)";&lt;br /&gt;cmd.Parameters.Add("@cat_name", SqlDbType.VarChar).Value = ((TextBox)GridView1.Rows[0].Cells[2].Controls[0]).Text;&lt;br /&gt;cmd.Connection = con;&lt;br /&gt;con.Open();&lt;br /&gt;cmd.ExecuteNonQuery();&lt;br /&gt;con.Close();&lt;/div&gt;&lt;div&gt;Response.Redirect("quest_categories.aspx");&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["exam_moduleConnectionString"].ConnectionString);&lt;br /&gt;SqlCommand cmd = new SqlCommand();&lt;br /&gt;cmd.CommandText = "UPDATE quest_categories SET &lt;a href="mailto:cat_name=@cat_name"&gt;cat_name=@cat_name&lt;/a&gt; WHERE &lt;a href="mailto:cat_id=@cat_id"&gt;cat_id=@cat_id&lt;/a&gt;";&lt;br /&gt;cmd.Parameters.Add("@cat_name", SqlDbType.VarChar).Value = ((TextBox)GridView1.Rows[e.RowIndex].Cells[2].Controls[0]).Text;&lt;br /&gt;cmd.Parameters.Add("@cat_id", SqlDbType.Int).Value = Convert.ToInt32(GridView1.Rows[e.RowIndex].Cells[1].Text);&lt;br /&gt;cmd.Connection = con;&lt;br /&gt;con.Open();&lt;br /&gt;cmd.ExecuteNonQuery();&lt;br /&gt;con.Close();&lt;br /&gt;}&lt;br /&gt;GridView1.EditIndex = -1;&lt;br /&gt;BindData();&lt;br /&gt;}&lt;br /&gt;Rest operations are same as you might have done before so I’m not explaining it further.&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4570388358056942020-7648603646502268620?l=deiva-apk.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://deiva-apk.blogspot.com/feeds/7648603646502268620/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4570388358056942020&amp;postID=7648603646502268620' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4570388358056942020/posts/default/7648603646502268620'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4570388358056942020/posts/default/7648603646502268620'/><link rel='alternate' type='text/html' href='http://deiva-apk.blogspot.com/2008/09/insert-update-delete-with.html' title='Insert, Update, Delete with Gridview....simple way using Stored Procedure'/><author><name>Deiva</name><uri>http://www.blogger.com/profile/01579444991016554353</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://2.bp.blogspot.com/_yOUXlZCsLwo/SijGXeEKTcI/AAAAAAAAAC4/wZCfvpFCaTQ/S220/IMG_2074.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_yOUXlZCsLwo/SM-aDceHP4I/AAAAAAAAAAo/HqkWqmlDCmU/s72-c/4.gif' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4570388358056942020.post-7683260252937954020</id><published>2008-07-30T13:44:00.000+05:30</published><updated>2008-07-30T13:49:06.381+05:30</updated><title type='text'>Lambda Expressions Extension Methods and LINQ in C# 3.0</title><content type='html'>The idea behind anonymous methods it to write methods inline to the code so you don't have to go through the trouble of declaring a formal named method. They are mainly used for small methods that don't require any need for reuse.&lt;br /&gt;&lt;br /&gt;Instead of declaring a separate method IsAbe to find Abe in a list of strings:&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;class Program&lt;br /&gt;{&lt;br /&gt;    static void Main(string[] args)&lt;br /&gt;    {                    &lt;br /&gt;        List&lt;string&gt; names = new List&lt;string&gt;();&lt;br /&gt;        names.Add("Dave");&lt;br /&gt;        names.Add("John");&lt;br /&gt;        names.Add("Abe");&lt;br /&gt;        names.Add("Barney");&lt;br /&gt;        names.Add("Chuck");&lt;br /&gt;        string abe = names.Find(IsAbe);&lt;br /&gt;        Console.WriteLine(abe);&lt;br /&gt;    }&lt;br /&gt;    public static bool IsAbe(string name)&lt;br /&gt;    {&lt;br /&gt;        return name.Equals("Abe");&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;You can declare an anonymous method inline to save you the trouble:&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;class Program&lt;br /&gt;{&lt;br /&gt;    static void Main(string[] args)&lt;br /&gt;    {                    &lt;br /&gt;        List&lt;string&gt; names = new List&lt;string&gt;();&lt;br /&gt;        names.Add("Dave");&lt;br /&gt;        names.Add("John");&lt;br /&gt;        names.Add("Abe");&lt;br /&gt;        names.Add("Barney");&lt;br /&gt;        names.Add("Chuck");&lt;br /&gt;        string abe = names.Find(delegate(string name)&lt;br /&gt;                        {&lt;br /&gt;                            return name.Equals("Abe");&lt;br /&gt;                        });&lt;br /&gt;        Console.WriteLine(abe);&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;It can get a lot fancier than that, but that is basically the gist. Declare the method inline to the code for easy stuff not needing reuse, because it saves some typing and puts the method closer to where it is being used which helps with maintenance.&lt;br /&gt;Lambda Expressions&lt;br /&gt;&lt;br /&gt;Lambda Expressions make things even easier by allowing you to avoid the anonymous method and that annoying statement block:&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;class Program&lt;br /&gt;{&lt;br /&gt;    static void Main(string[] args)&lt;br /&gt;    {                    &lt;br /&gt;        List&lt;string&gt; names = new List&lt;string&gt;();&lt;br /&gt;        names.Add("Dave");&lt;br /&gt;        names.Add("John");&lt;br /&gt;        names.Add("Abe");&lt;br /&gt;        names.Add("Barney");&lt;br /&gt;        names.Add("Chuck");&lt;br /&gt;        string abe = names.Find((string name)&lt;br /&gt;                          =&gt; name.Equals("Abe"));&lt;br /&gt;        Console.WriteLine(abe);&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;Because Lambda Expressions are smart enough to infer variable types, I don't even have to explicity mention that name is a string above. I can remove it for even more simplicity and write it as such:&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;class Program&lt;br /&gt;{&lt;br /&gt;    static void Main(string[] args)&lt;br /&gt;    {                    &lt;br /&gt;        List&lt;string&gt; names = new List&lt;string&gt;();&lt;br /&gt;        names.Add("Dave");&lt;br /&gt;        names.Add("John");&lt;br /&gt;        names.Add("Abe");&lt;br /&gt;        names.Add("Barney");&lt;br /&gt;        names.Add("Chuck");&lt;br /&gt;        string abe = names.Find(name =&gt;&lt;br /&gt;                           name.Equals("Abe"));&lt;br /&gt;        Console.WriteLine(abe);&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;Now there is no particular reason why I have to use name as my variable. Often developers will use 1 character variable names in Lambda Expressions just to keep things short. Here we replace name with p and all works the same.&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;class Program&lt;br /&gt;{&lt;br /&gt;    static void Main(string[] args)&lt;br /&gt;    {                    &lt;br /&gt;        List&lt;string&gt; names = new List&lt;string&gt;();&lt;br /&gt;        names.Add("Dave");&lt;br /&gt;        names.Add("John");&lt;br /&gt;        names.Add("Abe");&lt;br /&gt;        names.Add("Barney");&lt;br /&gt;        names.Add("Chuck");&lt;br /&gt;        string abe = names.Find(p =&gt; p.Equals("Abe"));&lt;br /&gt;        Console.WriteLine(abe);&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;Lambda Expressions Using a Customer Class&lt;br /&gt;&lt;br /&gt;I used a list of strings above, but you can just as easily use a list of objects to do the same thing. I will take an abbreviated form of a Customer Class:&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;public class Customer&lt;br /&gt;{&lt;br /&gt;    public int Id;&lt;br /&gt;    public string Name;&lt;br /&gt;    public string City;&lt;br /&gt;    public Customer(int id, string name, string city)&lt;br /&gt;    {&lt;br /&gt;        Id = id;&lt;br /&gt;        Name = name;&lt;br /&gt;        City = city;&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;and now use Lambda Expressions to find a particular Customer with a name of "Abe".&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;class Program&lt;br /&gt;{&lt;br /&gt;    static void Main(string[] args)&lt;br /&gt;    {            &lt;br /&gt;        List&lt;customer&gt; customers = new List&lt;customer&gt;();&lt;br /&gt;        customers.Add(new Customer(1,"Dave","Sarasota"));&lt;br /&gt;        customers.Add(new Customer(2,"John","Tampa"));&lt;br /&gt;        customers.Add(new Customer(3,"Abe","Miami"));&lt;br /&gt;        Customer abe = customers.Find(c =&gt;&lt;br /&gt;                               c.Name.Equals("Abe"));&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;Again, we could make things more obvious by explicity saying that c is of type Customer, but I wouldn't bet on many people doing it :) You could write the above as follows:&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;class Program&lt;br /&gt;{&lt;br /&gt;    static void Main(string[] args)&lt;br /&gt;    {            &lt;br /&gt;        List&lt;customer&gt; customers = new List&lt;customer&gt;();&lt;br /&gt;        customers.Add(new Customer(1,"Dave","Sarasota"));&lt;br /&gt;        customers.Add(new Customer(2,"John","Tampa"));&lt;br /&gt;        customers.Add(new Customer(3,"Abe","Miami"));&lt;br /&gt;        Customer abe = customers.Find((Customer c) =&gt;&lt;br /&gt;                                   c.Name.Equals("Abe"));&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;Combining Extension Methods and Lambda Expressions for Help In Finding Our Customer&lt;br /&gt;&lt;br /&gt;Let's say we have a custom CustomerCollection Class not within our control that doesn't provide us an easy way to find a Customer:&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;public class CustomerCollection :&lt;br /&gt;                     IEnumerable&lt;customer&gt;&lt;br /&gt;{&lt;br /&gt;    IEnumerable&lt;customer&gt; _customers;&lt;br /&gt;    public CustomerCollection(IEnumerable&lt;customer&gt;&lt;br /&gt;                                        customers)&lt;br /&gt;    {&lt;br /&gt;        _customers = customers;&lt;br /&gt;    }&lt;br /&gt;    public IEnumerator&lt;customer&gt; GetEnumerator()&lt;br /&gt;    {&lt;br /&gt;        foreach (Customer customer in _customers)&lt;br /&gt;            yield return customer;&lt;br /&gt;    }&lt;br /&gt;    System.Collections.IEnumerator System.Collections&lt;br /&gt;                        .IEnumerable.GetEnumerator()&lt;br /&gt;    {&lt;br /&gt;        return _customers.GetEnumerator();&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;Let's add an Extension Method to the CustomerCollection Class, called GetCustomer:&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;public static class CustomerExtensions&lt;br /&gt;{&lt;br /&gt;    public static Customer GetCustomer(this&lt;br /&gt;            CustomerCollection customers,&lt;br /&gt;            Predicate&lt;customer&gt; isMatch)&lt;br /&gt;    {&lt;br /&gt;        foreach (Customer customer in customers)&lt;br /&gt;            if (isMatch(customer))&lt;br /&gt;                return customer;&lt;br /&gt;        return null;&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;And now, we can use the CustomerCollection Class to easily find Abe like:&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;class Program&lt;br /&gt;{&lt;br /&gt;    static void Main(string[] args)&lt;br /&gt;    {                    &lt;br /&gt;        CustomerCollection collection = GetCustomers();    &lt;br /&gt;        // Using my GetCustomer Method Extension...&lt;br /&gt;        Customer abe = collection.GetCustomer(c =&gt;&lt;br /&gt;                                 c.Name.Equals("Abe"));&lt;br /&gt;    }&lt;br /&gt;    &lt;br /&gt;    // Pretend We Don't See This :)&lt;br /&gt;    static CustomerCollection GetCustomers()&lt;br /&gt;    {&lt;br /&gt;        List&lt;customer&gt; customers = new List&lt;customer&gt;();&lt;br /&gt;        customers.Add(new Customer(1,"Dave","Sarasota"));&lt;br /&gt;        customers.Add(new Customer(2,"John","Tampa"));&lt;br /&gt;        customers.Add(new Customer(3,"Abe","Miami"));&lt;br /&gt;        &lt;br /&gt;        return new CustomerCollection(customers);&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;But This Is LINQ!&lt;br /&gt;&lt;br /&gt;But, of course, since CustomerCollection implements IEnumerable&lt;t&gt;, in this case, IEnumerable&lt;customer&gt;, screw the Extension Methods and just use LINQ:&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;class Program&lt;br /&gt;{&lt;br /&gt;    static void Main(string[] args)&lt;br /&gt;    {                    &lt;br /&gt;        CustomerCollection collection = GetCustomers();    &lt;br /&gt;        // LINQ&lt;br /&gt;        var abe = collection.Single(c =&gt;&lt;br /&gt;                         c.Name.Equals("Abe"));&lt;br /&gt;    }&lt;br /&gt;    &lt;br /&gt;    // Pretend We Don't See This :)&lt;br /&gt;    static CustomerCollection GetCustomers()&lt;br /&gt;    {&lt;br /&gt;        List&lt;customer&gt; customers = new List&lt;customer&gt;();&lt;br /&gt;        customers.Add(new Customer(1,"Dave","Sarasota"));&lt;br /&gt;        customers.Add(new Customer(2,"John","Tampa"));&lt;br /&gt;        customers.Add(new Customer(3,"Abe","Miami"));&lt;br /&gt;        &lt;br /&gt;        return new CustomerCollection(customers);&lt;br /&gt;    }&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4570388358056942020-7683260252937954020?l=deiva-apk.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://deiva-apk.blogspot.com/feeds/7683260252937954020/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4570388358056942020&amp;postID=7683260252937954020' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4570388358056942020/posts/default/7683260252937954020'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4570388358056942020/posts/default/7683260252937954020'/><link rel='alternate' type='text/html' href='http://deiva-apk.blogspot.com/2008/07/lambda-expressions-extension-methods.html' title='Lambda Expressions Extension Methods and LINQ in C# 3.0'/><author><name>Deiva</name><uri>http://www.blogger.com/profile/01579444991016554353</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://2.bp.blogspot.com/_yOUXlZCsLwo/SijGXeEKTcI/AAAAAAAAAC4/wZCfvpFCaTQ/S220/IMG_2074.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4570388358056942020.post-5338026612458335129</id><published>2008-07-29T16:56:00.000+05:30</published><updated>2008-07-29T16:58:12.954+05:30</updated><title type='text'></title><content type='html'>When ASP.NET hit the street a couple of years ago, it was a real eye-opener. Microsoft's tool for creating dynamic, server side web applications introduced Web Forms, a feature with the same rapid drag and drop convenience enjoyed by Visual Basic developers, along with a method for creating XML-based web services. ASP.NET was more than an upgrade of Active Server Pages it was a quantum leap ahead. Now Microsoft has a new version of ASP.NET as part of its upcoming next generation release of the Visual Studio .NET development platform. ASP.NET 2.0 is already available in beta release, and web developers are anxious to get a good look at it. That's exactly what our new Developer's Notebook allows you to do. More than just an introduction to ASP.NET 2.0, this practical guide acquaints you with all of the new features through nearly 50 hands-on projects. Each one places emphasis on changes in the new release that can increase productivity, simplify programming tasks, and help you add functionality to your applications. For example, ASP.NET 2.0 includes master pages, themes, and skins so you can build applications with a consistent page layout and design. Other changes allow for the automatic creation of web pages for use on mobile devices, while wizards and controls allow you to perform frequent tasks (like data access) without having to write a single line of code. ASP.NET 2.0: A Developer's Notebook also includes suggestions for further experimentation, links to on-line documentation, and practical notes and warnings from the author regarding changes to the new version. The new Developer's Notebooks series from O'Reilly offers an in-depth first look at important new tools for software developers. Emphasizing example over explanation and practice over theory, they focus on learning by doing you'll get the goods straight from the masters, in an informal and code-intensive style. If you want to get up to speed on ASP.NET 2.0 before its official release, this all lab, no lecture book will get you there. &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4570388358056942020-5338026612458335129?l=deiva-apk.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://deiva-apk.blogspot.com/feeds/5338026612458335129/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4570388358056942020&amp;postID=5338026612458335129' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4570388358056942020/posts/default/5338026612458335129'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4570388358056942020/posts/default/5338026612458335129'/><link rel='alternate' type='text/html' href='http://deiva-apk.blogspot.com/2008/07/when-asp.html' title=''/><author><name>Deiva</name><uri>http://www.blogger.com/profile/01579444991016554353</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://2.bp.blogspot.com/_yOUXlZCsLwo/SijGXeEKTcI/AAAAAAAAAC4/wZCfvpFCaTQ/S220/IMG_2074.JPG'/></author><thr:total>0</thr:total></entry></feed>
