Skip to content

ErcanOPAK.com

  • ASP.Net WebForms
  • ASP.Net MVC
  • C#
  • SQL
  • MySQL
  • PHP
  • Devexpress
  • Reportviewer
  • About

Tag: function

C#

What is the difference between ‘ref’ and ‘out’ keywords in C#

- 14.01.23 - ErcanOPAK comment on What is the difference between ‘ref’ and ‘out’ keywords in C#

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 […]

Read More
SQL

How to create a single string from multiple rows in T-SQL and MySQL

- 05.12.22 - ErcanOPAK comment on 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 […]

Read More
ASP.Net MVC / ASP.Net WebForms / HTML / JavaScript

How to use client-side function on checkbox or any asp.net component

- 10.11.22 - ErcanOPAK comment on 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 […]

Read More
SQL

How to hide letters with asterisks except first letter in SQL

- 08.11.21 - ErcanOPAK comment on 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 ‘ %’ […]

Read More
SQL

SQL Server CONCAT_WS Function (Concat with Separator)

- 13.08.20 - ErcanOPAK comment on 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.

Read More
ASP.Net MVC / ASP.Net WebForms / C#

Creating Multiline textbox using Html.Helper function in Asp.Net MVC

- 23.07.20 | 23.07.20 - ErcanOPAK comment on Creating Multiline textbox using Html.Helper function in Asp.Net MVC

@Html.TextArea(“Body”, null, new { cols = “55”, rows = “10” }) or

Read More
C#

How to split string and get first (or n-th) value only

- 20.07.20 - ErcanOPAK comment on 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]

Read More
SQL

Drop all the tables, stored procedures, triggers, constraints and all the dependencies in one sql statement

- 27.10.19 | 22.11.19 - ErcanOPAK comment on 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 […]

Read More
SQL

Average of all values in a column that are not zero in SQL

- 11.06.19 | 22.11.19 - ErcanOPAK comment on 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))

Read More
SQL

DATEADD Function in SQL

- 14.06.18 | 22.11.19 - ErcanOPAK comment on 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 […]

Read More
ASP.Net WebForms / HTML / JavaScript

Get and Use TextBox Values with Javascript

- 04.06.18 | 22.11.19 - ErcanOPAK comment on Get and Use TextBox Values with Javascript

Here is the example code to get and use TextBox Values with Javascript:

Read More
November 2023
M T W T F S S
 12345
6789101112
13141516171819
20212223242526
27282930  
« Oct    

Most Viewed Posts

  • Get the First and Last Word from a String or Sentence in SQL (692)
  • Get the User Name and Domain Name from an Email Address in SQL (690)
  • How to select distinct rows in a datatable in C# (549)
  • Add Constraint to SQL Table to ensure email contains @ (446)
  • Average of all values in a column that are not zero in SQL (366)
  • How to use Map Mode for Vertical Scroll Mode in Visual Studio (336)
  • How to enable, disable and check if Service Broker is enabled on a database in SQL Server (333)
  • Find numbers with more than two decimal places in SQL (320)
  • Confirm before process with ASPxButton in Devexpress (313)
  • ASPxGridView – Disable CheckBox based on condition in GridViewCommandColumn (288)

Recent Posts

  • How to convert JPG or PNG to WebP in batch or single mode
  • How to get the first and the last day of previous month in SQL Server
  • Not Null check on LEFT function with T-SQL
  • NICE 100 YILLARA TÜRKİYEM
  • How to delete all commit history in github
  • How to display HTML components on the same line in CSS
  • How to insert results of a stored procedure into a temporary table
  • How to remove all non alphanumeric characters from a string in C#
  • How to get the Xth Day of the Week of the Year in C#
  • How to get formatted JSON in C#

Most Viewed Posts

  • Get the First and Last Word from a String or Sentence in SQL (692)
  • Get the User Name and Domain Name from an Email Address in SQL (690)
  • How to select distinct rows in a datatable in C# (549)
  • Add Constraint to SQL Table to ensure email contains @ (446)
  • Average of all values in a column that are not zero in SQL (366)

Recent Posts

  • How to convert JPG or PNG to WebP in batch or single mode
  • How to get the first and the last day of previous month in SQL Server
  • Not Null check on LEFT function with T-SQL
  • NICE 100 YILLARA TÜRKİYEM
  • How to delete all commit history in github

Social

  • ErcanOPAK.com
  • GoodReads
  • LetterBoxD
  • Linkedin
  • The Blog
  • Twitter

© 2023 ErcanOPAK.com

Proudly powered by WordPress | Theme: Xblog Plus by wpthemespace.com