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: 582
  • 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: 449
  • sql server

Upload multiple image in multiple size with progress bar in

In 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 [][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: 5,784
  • flajaxian
  • image

Check/Uncheck all checkboxes in 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: 4,372
  • 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: 315
  • 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: 829
  • c#

How to retrieve data from database using JavaScript in

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: 11,947
  • javascript
  • sql server

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: 25,959
  • ajax
  • 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: 3,692
  • linq to sql
  • web.config
Prev1 ... 1112