All
SQL Server introduced three new conversion functions to convert an expression to another data type, in this post we will see those functions and their usage
**Conversion Functions**
- PARSE
- TRY_PARSE
- TRY_CONVERT
**PARSE:** This function parse the value and return then result, relies on CLR. It will take some performance overhead. Syntax
PARSE (string_value AS data_type [...
By Hamden
Posted On 15 May 2013 07:16 PM
Sometimes we need to get the total number of days in month for given date, there is no build in function which can help us to directly use and get our result, so we need to write a small SQL statement to get the total number of days for a particular date.
I found on some blog sites to use this but it will not work for every date
DECLARE @date DATETIME
SET @date = '05/17/2020'
...
By Hamden
Posted On 14 May 2013 06:34 PM
When we create function we can use default value for parameters if we need so, is there any way to create a procedure with default value parameter in SQL Server so when we don’t pass the value for that parameter they can use default values? Yes, we can. In this article we will create procedure with default parameter value.
First let’s see how we can create a procedure is SQL Server
...
By Ali Adravi
Posted On 14 May 2013 05:43 PM
Windows service can be setup by using DOS command but that is not so easy especially for those people who are not technically strong, some time we create windows service for our client and the want a setup file so they simply click on the setup file and follow the instruction. So we will see how to create a windows service setup with Visual Studio. To learn how to create windows service see my...
By Ali Adravi
Posted On 11 May 2013 07:37 PM
How to search a column name in any table (entire database) or how to check a column exists in any table or not, how to check a column belongs to which table, these are very common question we can get on different websites. Some times we know the column name but don't know the column name then we need a script to get the table name to proceed.
Suppose we have table with primary key and want to...
By Hamden
Posted On 09 May 2013 06:43 PM
How to change column name and data type of a column cannot be done in one statement but first we need to change the column name and then data type, In this post we will check many other things like how to change data type of a column, how to drop a column, how to add a new column, how to make a column not nullable etc.
So first we will see how to change a column name as well as data type of...
By Hamden
Posted On 05 May 2013 07:10 AM
Country will be filled on page load and once user will select any country we will fill states from that country and again when user will change state we will fill city for that state without postback ( asynchronously) with the help of update panel in asp.net.
Create three methods to fetch country, state by country and city by state
CountryRepository.FetchCountries(); to fetch country...
By Hamden
Posted On 04 May 2013 09:32 PM
just think to pass comma separated Id as a parameter or how to use comma delimited value as parameter and use that in SQL server, since there is no way to use parameter as an array so we can use string for multiple IDs or values but if it's integer then we cannot use it in IN clause in SQL Server even if it is string (varchar). So how to use multiple values or IDs as parameter and use that in IN...
By Ali Adravi
Posted On 02 May 2013 07:29 PM
We can not directly change a column to identity columns, say we have a primary key column or any normal column in our table and want to make it identity column then we cannot do it directly by altering the table but there are only two way to change column to identity column
1. Create a new table with same structure and identity column and copy existing table records to this table and drop the...
By Ali Adravi
Posted On 02 May 2013 06:46 PM
Creating windows service in C# is really easy but when we need to create first time we face many problems so in this post we will try to learn everything about window service. In this article we will create a windows service which will run after a particular interval, and time should be configurable and code to write log in a text file as well as send email if there is any error to execute the...
By Ali Adravi
Posted On 30 Apr 2013 06:55 PM
In many cases we need to use read only text box so user cannot edit the value but readonly textbox will lost its value after postback. Let’s say you have a read only text box to set date by using ajax calendar so after post back date will be lost, other case might be you are setting some value in design view of aspx page which will lost after post back.
Suppose you have following HTML in your...
By Ali Adravi
Posted On 24 Apr 2013 06:32 PM
There are ways to call a web service method JavaScript, for more detail you can see [how to retrieve data from database using JavaScript in asp.net][1], but is there any way to call a normal method from JavaScript? And the answer is No; show how we can call a code behind method from JavaScript, let’s see this with code
Add following HTML on page:
<asp:ScriptManager ID="ScriptManager1"...
By Jonathan King
Posted On 08 Apr 2013 07:50 PM
In this article we will discuss different way of show and hide (open and close) modal popup by using Ajax ModalPopupExtender, how to open/close a modal popup from code behind in asp.net or by using JavaScript, how to use multiple buttons to hide the modal popup in asp.net etc.
Suppose we have a grid view to show the record in tabular format and give functionality to edit a record from grid...
By Jonathan King
Posted On 08 Apr 2013 06:57 PM
We can use JavaScript to get parent element or jQuery to get parent element but which one would be best for you is up to your need and familiarity with JavaScript and jQuery. In this article we will take different conditions and examples to show how jquery finds parent element and same case with JavaScript.
First we will see the simplest form of parent of any element
<div id="div1">
...
By Hamden
Posted On 06 Apr 2013 08:14 PM
To show blurred, faded or washed-out image by using CSS and clear effect on mouse over on the image we need to use simply two CSS opacity and filter: alpha
See following image, by default all will be faded on page load and once user will mouse over on any image that will look like the third image means that will be cleared.
![alt text][1]
We can use these CSS anywhere in our application,...
By Jason Olivera
Posted On 06 Apr 2013 09:42 AM
In my early day career in many interviews I asked same question, what is overloading and overriding so decided to write this small article which may help someone. We will see here in detail about the overloading, overriding and then differences between them.
**Overloading:** is the mechanism to have more than one method with same name but with different signature (parameters). A method can be...
By Hamden
Posted On 31 Mar 2013 03:10 PM
There are many ways which can help us to save our time to write some repeated code or to do some repeated action, in this post we will see some very common code which we need very frequently in our development life. I am not saying that after this post you will save your half say work every day but hope fully you will get something for you which can may you happier, so let’s start one by...
By Ali Adravi
Posted On 31 Mar 2013 07:03 AM
In JavaScript we have a function isNan (Not a number) to check whether the value is a number or not. It takes only one parameter, value and returns true or false, we will check here some values and conditions to understand it better.
It supports in all browsers.
isNaN(123); // false -- 123 is a number
isNaN(1.23); // false -- 1.23 is a number
isNaN(12 - 3); // false...
By Jason Olivera
Posted On 30 Mar 2013 06:10 AM
We will discuss here what is IEnumerable, IEnumerator, what are differences between them, where should we use IEnumerable and where to IEnumerator, once we will finish our discussion it will be clear, which one would be best for which situation and why, so let’s see it with example
To better understand we will create a list of age
List<int> ages = new List<int>();
ages.Add(10);
...
By Ali Adravi
Posted On 29 Mar 2013 08:58 PM
C# the language, right from the very beginning is always supported covariance and contravariance but in most simple scenario, now in C# 4.0 we have full support of covariance and contravariance in all circumstances, generic interface and generic delegates, other C# types already support from first version of C#. These two terms sounds like technically scary as we will see they are incredibly...
By Ali Adravi
Posted On 29 Mar 2013 06:57 PM
