AmitDiwan has Published 10744 Articles

Add an object to the end of Collection in C#

AmitDiwan

AmitDiwan

Updated on 16-Dec-2019 06:29:59

240 Views

To add an object to the end of Collection, the code is as follows −Exampleusing System; using System.Collections.ObjectModel; public class Demo {    public static void Main() {       Collection col = new Collection();       col.Add(10);       col.Add(20);       col.Add(30);     ... Read More

Deleting partial data from a field in MySQL?

AmitDiwan

AmitDiwan

Updated on 16-Dec-2019 06:26:55

275 Views

To delete partial data, use UPDATE command along with REPLACE(). Let us first create a table −mysql> create table DemoTable1583    -> (    -> GameDetails text    -> ); Query OK, 0 rows affected (1.38 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1583 values('=Candy, ... Read More

Add a string to the end of the StringCollection in C#

AmitDiwan

AmitDiwan

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

111 Views

To add a string to the end of the StringCollection, the code is as follows −Exampleusing System; using System.Collections.Specialized; public class Demo {    public static void Main() {       StringCollection strCol = new StringCollection();       strCol.Add("John");       strCol.Add("Tim");       strCol.Add("Gary");   ... Read More

Query MySQL table and fetch rows posted before the last 3 days?

AmitDiwan

AmitDiwan

Updated on 16-Dec-2019 06:25:24

166 Views

Let’s say the current date is −'2019-10-20We will first see an example and create a table −mysql> create table DemoTable1582    -> (    -> PostedDate datetime    -> ); Query OK, 0 rows affected (13.36 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1582 values('2019-01-21 ... Read More

How to get all elements of a List that match the conditions specified by the predicate in C#?

AmitDiwan

AmitDiwan

Updated on 16-Dec-2019 06:22:50

631 Views

To get all elements of a List that match the conditions specified by the predicate, the code is as follows −Exampleusing System; using System.Collections.Generic; public class Demo {    private static bool demo(int i) {       return ((i % 3) == 0);    }    public static void ... Read More

How to ensure that MySQL rows are unique?

AmitDiwan

AmitDiwan

Updated on 16-Dec-2019 06:19:54

453 Views

To ensure that MySQL rows are unique, you need to use UNIQUE constraint. Let us first create a table −mysql> create table DemoTable1580    -> (    -> id int,    -> Name varchar(20),    -> Age int    -> ); Query OK, 0 rows affected (0.73 sec)Here is the ... Read More

How to get hash code for the specified key of a Hashtable in C#?

AmitDiwan

AmitDiwan

Updated on 16-Dec-2019 06:19:21

263 Views

To get hash code for the specified key of a Hashtable, the code is as follows −Example Live Demousing System; using System.Collections; public class HashCode : Hashtable {    public static void Main(string[] args) {       HashCode hash = new HashCode();       hash.Add("A", "Jacob");       ... Read More

How to select the last three rows of a table in ascending order with MySQL?

AmitDiwan

AmitDiwan

Updated on 16-Dec-2019 06:15:52

679 Views

To select the last three rows in ascending order, use ORDER BY DESC LIMIT as in the below syntax −select * from (select * from yourTableName order by yourColumnName desc limit 3) anyAliasName order by yourColumnName ;Let us first create a table −mysql> create table DemoTable1579    -> (   ... Read More

How to get Synchronize access to the ListDictionary in C#?

AmitDiwan

AmitDiwan

Updated on 16-Dec-2019 06:15:05

169 Views

To get synchronize access to the ListDictionary, the code is as follows −Example Live Demousing System; using System.Collections; using System.Collections.Specialized; public class Demo {    public static void Main() {       ListDictionary dict = new ListDictionary();       dict.Add("1", "SUV");       dict.Add("2", "Sedan");       ... Read More

MySQL select and insert in two tables with a single query

AmitDiwan

AmitDiwan

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

385 Views

Here is the query to create first table.mysql> create table DemoTable1    -> (    -> StudentName varchar(20),    -> StudentMarks int    -> ); Query OK, 0 rows affected (0.67 sec)To understand the above concept, let us create second table.mysql> create table DemoTable2    -> (    -> Name ... Read More

Advertisements