All

Error cannot be caught by a TRY…CATCH Construct in SQL Server

TRY…CATCH constructs do not trap the following conditions: - Warnings or informational messages that have a severity of 10 or lower. - Errors that have a severity of 20 or higher those stop the SQL Server Database Engine task processing for the session. If an error occurs that has severity of 20 or higher and the database connection is not disrupted, TRY…CATCH will handle the error. -... By Ali Adravi   On 28 Dec 2012  Viewed: 575
  • sql server

SQL transaction status and XACT_STATE()

XACT_STATE() is a scalar function that gives the user transaction state of a current running request. It indicates whether the request has an active user transaction, and whether the transaction is capable of being committed or not. XACT_STATE returns the following three values - **1**: The current request has an active user transaction. The request can perform any actions, including... By Ali Adravi   On 28 Dec 2012  Viewed: 7,838
  • sql server

Web security and helpful resources

- **Complacency** 1. Educate yourself. 2. Assume your applications will be hacked. 3. Remember that it’s important to protect user data. - **Cross-Site Scripting (XSS)** 1. HTML-encode all content. 2. Encode attributes. 3. Remember JavaScript encoding. 4. Use AntiXSS if possible. - **Cross-Site Request Forgery (CSRF)** 1. Token Verification. ... By Ali Adravi   On 27 Dec 2012  Viewed: 373
  • asp.net

Boxing and Unboxing in C#

We know that C# data types are divided into two types, value type and reference type 1. Value types, which are allocated on the stack and 2. Reference types, which are allocated on the heap How does this square with the ability to call methods on an int, which is a value on the stack? The way C# achieves this is through a bit of magic called boxing. Boxing and its counterpart... By Ali Adravi   On 27 Dec 2012  Viewed: 1,155
  • c#
  • oops

HTML vs XHTML

HTML syntax, this is the format suggested for most authors. It is compatible with most legacy Web browsers. If a document is transmitted with the `text/html MIME` type, then it will be processed as an HTML document by Web browsers. This specification defines version 5 of the HTML syntax, known as "HTML5". XHTML syntax, which is an application of XML. When a document is transmitted with an XML... By Alicia Gonzalez   On 25 Dec 2012  Viewed: 1,069
  • xml
  • html

What is XML and it's usage?

XML (Extensible Markup Language) is a simple text-based format for representing structured information: documents, data, configuration, books, transactions, invoices, and much more. It was derived from an older standard format called SGML. **XML Used For** XML is one of the most widely-used formats for sharing structured information today: between programs, between people, between... By Alicia Gonzalez   On 25 Dec 2012  Viewed: 983
  • xml

JavaScript getAttribute() Method

In JavaScript getAttribute() method is used to get the value of an attribute in an object. **Syntax:** object.getAttribute(attributename) **Parameter:** It takes only one parameter *attributename* **Example:** Suppose you have an anchor tag with following attributes <a href="http://www.advancesharp.com" id="hlnkWebsite" target ="_blank" title=... By Alicia Gonzalez   On 02 Dec 2012  Viewed: 687
  • javascript

jQuery and chexkbox

Whenever I need to use jquery with checkbox different functionality I always search for different sites to get my answer so I decided to write a small article to keep all the jquery functionality with checkbox at a single place, so trying to keep everything here. ***To get a checkbox on a page use*** 1. $(':checkbox') 2. $('[type=checkbox]') 3. $('*:checkbox') 4.... By Ali Adravi   On 16 Nov 2012  Viewed: 899
  • jquery

Conditional where clause in SQL server and tricks

*Suppose you want to search the records on the basis of start and end date and for that if ModifiedDate is not null then use it otherwise use the Creation date:* Simply we can use, if in where clause like this If ModifiedDate IS NULL Where CreationDate Between @StartDate And @EndDate Else Where ModifiedDate Between @StartDate And @EndDate If there... By Ali Adravi   On 14 Jul 2012  Viewed: 654
  • sql server

Prevent SQL Injection in your application

I found many web sites where easily inject the SQL and logged in there, so what is wrong with these web site code. Are they not authenticating the user information? They are, so how can anyone can logged in without creating the account? Let’s say you have written code to authenticate the user from your database like this: SqlCommand cmd = new SqlCommand(); cmd.CommandText = "Select... By A K Sinha   On 14 Jul 2012  Viewed: 522
  • sql server

Upload multiple image in multiple size with progress bar in asp.net

In asp.net there is not control to select multiple files and upload them once with progress bar, so we will use a small third party DLL to achieve this functionality. We will use Flajaxian FileUploader, you can download it from [http://www.flajaxian.com][1] We will create three different images of size 100X100, 400X400 and original file, you can say thumbnail, medium size image and original... By Hamden   On 12 Jul 2012  Viewed: 6,536
  • asp.net
  • flajaxian
  • image

Check/Uncheck all checkboxes in asp.net by javascript

I was searching for select/deselect all checkboxes code into a gridview. I found most of them only provide to select and deselet all the checkboxes if any of the checkbox is unselected into grid the main checkbox is not affecting. I further try to search some useful code but could not found any useful solution, some of them are selecting all the checkboxes on the page or some provides only to... By Ali Adravi   On 10 Jul 2012  Viewed: 5,337
  • asp.net
  • javascript

With statement and it's usage in sql server 2008

A new feature introduced in sql server 2005 named common table expression, it's really cool feature to use in many cases to solve the complicated problems in sql server. **As defined by the Microsoft:** It specifies a temporary named result set, known as a common table expression (CTE). This is derived from a simple query and defined within the execution scope of a single *SELECT, INSERT,... By Liam Kelley   On 04 Jul 2012  Viewed: 379
  • sql server

Optional Parameters and Named Parameters In C# 4.0

A long-requested feature for C# was to allow for method parameters to be optional. Two closely related features in C# 4.0 fulfill this role and enable us to either omit arguments that have a defined default value when calling a method(optional parameter), and to pass arguments by name rather than position when calling a method(named arguments). The main benefit of these features is to improve... By Alicia Gonzalez   On 27 Jun 2012  Viewed: 926
  • c#

How to retrieve data from database using JavaScript in asp.net

I was checking how to validate a user email from database without post back, using JavaScript. After some search and RND found the way to call the web service method with the help of Ajax and JavaScript. Let’s say we have a registration page on which we accept email from the user and we expect it should be unique in entire database. So we need a method to immediately validate the email from... By Ali Adravi   On 24 Jun 2012  Viewed: 14,505
  • javascript
  • sql server
  • asp.net

Disable dates in Ajax CalendarExtender

Ajax CalendarExtendar: I found many questions on different sites regarding date range selection in Ajax CalendarExtender, while it is quite simple to bound the range to select from, you can allow all the dates, disable past dates, disable date greater than current date, date should be greater than current date + 1 month, current date to 1 month etc. So let me explain one by one: **For all... By Jonathan King   On 23 Jun 2012  Viewed: 28,378
  • ajax
  • asp.net
  • datepicker
  • jquery

Linq to SQL connection String to read from web.config file automatically

When we use Linq to SQL it creates a connection string in Settings files. When we need to create the DLL of the DataAccessLayer (DAL) for production server or any server which is not our current development server then we need to change connection string manually in Settings file, is not it would be good to set something in application so it can always read the connection string form web.config... By Montana Neyra   On 17 Jun 2012  Viewed: 4,984
  • linq to sql
  • web.config
  • asp.net
Prev1 ... 1112