AmitDiwan has Published 10740 Articles

Insert an element into Collection at specified index in C#

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 06:45:10

393 Views

To insert an element into Collection at the specified index, the code is as follows −Example Live Demousing System; using System.Collections.ObjectModel; public class Demo {    public static void Main(){       Collection col = new Collection();       col.Add("Laptop");       col.Add("Desktop");       col.Add("Notebook");   ... Read More

Insert a new entry in OrderedDictionary with specified key and value in C#

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 06:41:26

143 Views

To insert a new entry in OrderedDictionary with specified key and value, the code is as follows −Example Live Demousing System; using System.Collections; using System.Collections.Specialized; public class Demo {    public static void Main(){       OrderedDictionary dict = new OrderedDictionary();       dict.Add("1", "One");       dict.Add("2", ... Read More

Getting last value in MySQL group concat?

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 06:39:32

738 Views

To get last value in group concat, use SUBSTRING_INDEX(). Let us first create a table −mysql> create table DemoTable1525    -> (    -> ListOfSubjects text    -> ); Query OK, 0 rows affected (1.13 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1525 values('MongoDB, C'); ... Read More

Check whether an element is contained in the ArrayList in C#

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 06:38:41

217 Views

To check whether an element is contained in the ArrayList, the code is as follows −Example Live Demousing System; using System.Collections; public class Demo {    public static void Main(){       ArrayList list = new ArrayList();       list.Add("One");       list.Add("Two");       list.Add("Three");   ... Read More

Check whether a Hashtable contains a specific key or not in C#

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 06:35:31

184 Views

To check whether a Hashtable contains a specific key or not, the code is as follows −Example Live Demousing System; using System.Collections; public class Demo {    public static void Main(){       Hashtable hash = new Hashtable();       hash.Add("One", "Katie");       hash.Add("Two", "John");     ... Read More

Match the elements of an array in a MySQL query

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 06:33:22

2K+ Views

Let us first create a table table −mysql> create table DemoTable1523    -> (    -> Id int,    -> Value int    -> ); Query OK, 0 rows affected (0.76 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1523 values(1, 56); Query OK, 1 row ... Read More

Check the HybridDictionary for a specific key in C#

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 06:32:29

137 Views

To check the HybridDictionary for a specified key, the code is as follows −Example Live Demousing System; using System.Collections; using System.Collections.Specialized; public class Demo {    public static void Main(){       HybridDictionary dict = new HybridDictionary(5);       dict.Add("A", "AB");       dict.Add("B", "BC");       ... Read More

Sum columns corresponding values according to similar dates in MySQL?

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 06:31:06

237 Views

For this, use aggregate function SUM() along with GROUP BY. Let us first create a table −mysql> create table DemoTable1522    -> (    -> ProductPurchaseDate date,    -> NumberOfProduct int    -> ); Query OK, 0 rows affected (1.51 sec)Insert some records in the table using insert command −mysql> ... Read More

Convert Class in C#

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 06:29:45

750 Views

The Convert Class has methods to convert a base data type to another base data type. Let us see some examples −The Convert.ToBoolean() method in C# is used to convert a specified value to an equivalent Boolean value.SyntaxFollowing is the syntax −public static bool ToBoolean (string val, IFormatProvider provider);Above, Val ... Read More

Update a column in MySQL and remove the trailing underscore values

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 06:27:28

573 Views

To remove the trailing values, use TRIM() as in the below update syntax −update yourTableName set yourColumnName=trim(trailing '_' from yourColumnName);Let us first create a table −mysql> create table DemoTable1521    -> (    -> StudentCode varchar(20)    -> ); Query OK, 0 rows affected (1.33 sec)Insert some records in the ... Read More

Advertisements