Skip to content

ErcanOPAK.com

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

Tag: array

C#

Convert comma separated string into a List in C#

- 03.01.21 | 03.01.21 - ErcanOPAK comment on Convert comma separated string into a List in C#

string myList = “9,3,12,43,2”; List<int> intList = myList.Split(‘,’).Select(int.Parse).ToList();

Continue Reading ..
C#

Converting a List to a comma separated string in C#

- 03.01.21 - ErcanOPAK comment on Converting a List to a comma separated string in C#

List<int> list = new List<int>() {1,2,3}; string.Join<int>(“,”, list) Join has generic overloads. It is so much easier to use it in that way to convert your list to the different types.

Continue Reading ..
SQL

How to find the first missing value in a series in MS SQL

- 14.04.20 - ErcanOPAK comment on How to find the first missing value in a series in MS SQL

Let’s say we have this values in the database: num — 1 2 4 5 6 8 9 11 To Find the first missing value, we can use this: ;WITH CteRN AS( SELECT *, RN = num – ROW_NUMBER() OVER(ORDER BY num) FROM tbl ) SELECT TOP 1 num – RN FROM CteRN WHERE RN […]

Continue Reading ..
C#

Determine If string contains more than 1 value in C#

- 16.03.20 | 29.03.20 - ErcanOPAK comment on Determine If string contains more than 1 value in C#

Let’s say you have a condition like that: if ((myString.Contains(“Value1”) && (myString.Contains(“Value2”)) && (myString.Contains(“Value3”))) { … } Basically, you want to check if all of your values are contained in the string . Fortunately (with the help of LINQ), this can by translated almost literally into C#: var values = new String[] {“Value1”, “Value2”, “Value3”}; if […]

Continue Reading ..
C#

How to select distinct rows in a datatable in C#

- 10.03.20 - ErcanOPAK comment on How to select distinct rows in a datatable in C#

dataTable.DefaultView.ToTable(true, “target_column”); first parameter in ToTable() is a boolean which indicates whether you want distinct rows or not. second parameter in the ToTable() is the column name based on which we have to select distinct rows. Only these columns will be in the returned datatable. If you need to get distinct based on two columns: dataTable.DefaultView.ToTable(boolean, params string[] columnNames)

Continue Reading ..
MySQL / PHP

Repeater Function in PHP

- 05.05.19 | 22.11.19 - ErcanOPAK comment on Repeater Function in PHP

You need to do a while loop to pull each rowset. mysql_fetch_array() will only pull one row at a time. Consider this solution: <?php $dbhost = ‘xxxx’; $dbuser = ‘xxxx’; $dbpass = ‘xxxx’; $dbname = ‘xxxx’; $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die (‘Error connecting to mysql’); mysql_select_db($dbname, $conn); $result = mysql_query(“SELECT * FROM mytable”, $conn); <table> […]

Continue Reading ..
April 2021
M T W T F S S
 1234
567891011
12131415161718
19202122232425
2627282930  
« Jan    

Most Viewed Posts

  • Get the First and Last Word from a String or Sentence in SQL (243)
  • How to use Map Mode for Vertical Scroll Mode in Visual Studio (194)
  • How to make some specific word(s) Bold or Underline in ReportViewer (187)
  • How to solve “Response.Redirect cannot be called in a Page callback” for DevExpress Components (183)
  • Confirm before process with ASPxButton in Devexpress (172)
  • ASPxGridView – Disable CheckBox based on condition in GridViewCommandColumn (170)
  • Find numbers with more than two decimal places in SQL (168)
  • Devexpress ASPxGridview Column Grouping in Code (164)
  • DATEADD Function in SQL (163)
  • Tense Changes When Using Reported Speech (160)

Recent Posts

  • How to check for ‘IS NOT NULL’ And ‘IS NOT EMPTY’ string in SQL
  • How to auto-scroll or manually to end of div when data is added
  • Filter Rows By Max Date in SQL
  • How to Validate a DateTime in C#?
  • Convert comma separated string into a List in C#
  • Converting a List to a comma separated string in C#
  • How to add placeholder to Multiple Selection DropDownList in Asp.Net MVC
  • How to use toFixed() for Float numbers in Javascript
  • Convert List to List in one line in C#
  • How to use column search in datatable when responsive is false

Recent Posts

  • How to check for ‘IS NOT NULL’ And ‘IS NOT EMPTY’ string in SQL
  • How to auto-scroll or manually to end of div when data is added
  • Filter Rows By Max Date in SQL
  • How to Validate a DateTime in C#?
  • Convert comma separated string into a List in C#

Most Viewed Posts

  • Get the First and Last Word from a String or Sentence in SQL (243)
  • How to use Map Mode for Vertical Scroll Mode in Visual Studio (194)
  • How to make some specific word(s) Bold or Underline in ReportViewer (187)
  • How to solve “Response.Redirect cannot be called in a Page callback” for DevExpress Components (183)
  • Confirm before process with ASPxButton in Devexpress (172)

Social

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

powered by XBlog Plus WordPress Theme