The best way to understand that difference is to show it in code. Let’s say we have an ‘Add’ function. And the only thing that method does is add 10 to the parameter value. static void Main (string[] args) { int myParameter = 20; Add(myParameter); Console.WriteLine(myParameter); } static void Add(int myParameter) { myParameter = myParameter […]
Tag: function
How to create a single string from multiple rows in T-SQL and MySQL
To create a single string from multiple rows in MySQL, you can use the GROUP_CONCAT function. This function allows you to concatenate values from multiple rows into a single string, separated by a specified delimiter. Here is an example of how you can use this function: SELECT GROUP_CONCAT(column_name ORDER BY column_name ASC SEPARATOR ‘,’) FROM […]
How to use client-side function on checkbox or any asp.net component
Here is the Asp part: <label for=”chkCondition”> <asp:CheckBox ID=”chkCondition” Text=”Should i show the div?” runat=”server” onclick=”ShowHideDiv(this)” /> </label> <hr /> <div id=”divToShowOrHide” style=”display: none”> this div will be shown regarding the checkbox checked status. <asp:TextBox ID=”myTextBox” runat=”server” /> </div> And here is the Javascript part: <script type=”text/javascript”> function ShowHideDiv(chkCondition) { var divToShowOrHide = document.getElementById(“divToShowOrHide”); divToShowOrHide.style.display […]
How to hide letters with asterisks except first letter in SQL
The easiest way to do that is using a function CREATE FUNCTION [dbo].[HideNameWithAsterisks](@Name varchar(max)) RETURNS varchar(MAX) AS BEGIN DECLARE @loop int = LEN(@Name) WHILE @loop > 1 SELECT @Name = STUFF(@Name, @loop, 1, CASE WHEN SUBSTRING(@Name, @loop – 1, 2) like ‘% ‘ THEN ‘ ‘ WHEN SUBSTRING(@Name, @loop – 1, 2) like ‘ %’ […]
SQL Server CONCAT_WS Function (Concat with Separator)
The SQL Server CONCAT_WS() function concatenates two or more strings into one string with a separator. CONCAT_WS() means concatenate with separator.
Creating Multiline textbox using Html.Helper function in Asp.Net MVC
@Html.TextArea(“Body”, null, new { cols = “55”, rows = “10” }) or
How to split string and get first (or n-th) value only
string myValueToSplit = “Istanbul, Tokyo, Seoul, Bangkok, Bali, Minsk, Belgrade, Kiev”; var theFirstValue = myValueToSplit.Split(‘,’)[0]; //OUTPUT: theFirstValue = “Istanbul” //You can change [0] as you wish. //For example, if you want to get Kiev, make it [7]
Drop all the tables, stored procedures, triggers, constraints and all the dependencies in one sql statement
These 2 scripts clean all views, SPS, functions PKs, FKs and tables. 1. The First script by Adam Anderson, updated to support objects in other schemas than dbo: — check constraints select @stmt = isnull( @stmt + @n, ” ) + ‘alter table [‘ + schema_name(schema_id) + ‘].[‘ + object_name( parent_object_id ) + ‘] drop […]
Average of all values in a column that are not zero in SQL
SELECT AVG (CASE WHEN Value <> 0 THEN Value ELSE NULL END) …. AVG function will not take into account NULL values. So you can also use this AVG (NULLIF(Value, 0))
DATEADD Function in SQL
DATEADD(interval, number, date) Parameter Values (interval, number, date) Parameter Description interval Required. The time/date part to return. Can be one of the following values: year, yyyy, yy = Year quarter, qq, q = Quarter month, mm, m = month dayofyear = Day of the year day, dy, y = Day week, ww, wk = Week […]
Get and Use TextBox Values with Javascript
Here is the example code to get and use TextBox Values with Javascript: