AmitDiwan has Published 10740 Articles

Treat a MySQL column field as NULL if it is blank?

AmitDiwan

AmitDiwan

Updated on 08-Nov-2019 10:47:17

250 Views

Let us first create a table −mysql> create table DemoTable1362     -> (     -> ClientId int NOT NULL AUTO_INCREMENT PRIMARY KEY,     -> ClientName varchar(40)     -> ); Query OK, 0 rows affected (0.67 sec)Insert some records in the table using insert command −mysql> insert ... Read More

Boolean.CompareTo(Boolean) Method in C#

AmitDiwan

AmitDiwan

Updated on 08-Nov-2019 10:46:15

636 Views

The Boolean.CompareTo(Boolean) method in C# is used to compare this instance to a specified Boolean object and returns an integer that indicates their relationship to one another.SyntaxFollowing is the syntax −public int CompareTo (bool val);Above, Val is a Boolean object to compare to the current instance.ExampleLet us now see an ... Read More

How to find all tables that contains two specific columns in MySQL?

AmitDiwan

AmitDiwan

Updated on 08-Nov-2019 10:45:23

700 Views

To find two specific column names, use information_schema.columns Here, I am using Id in place of columnA and Name in place of columnB −mysql> select table_name as TableNameFromWebDatabase    -> from information_schema.columns    -> where column_name IN ('Id', 'Name')    -> group by table_name    -> having count(*) = 3;This ... Read More

BitConverter.ToBoolean() Method in C#

AmitDiwan

AmitDiwan

Updated on 08-Nov-2019 10:43:35

189 Views

The BitConverter.ToBoolean() method in C# returns a Boolean value converted from the byte at a specified position in a byte array.SyntaxFollowing is the syntax −public static bool ToBoolean (byte[] arr, int startIndex);Above, arr is a byte array, whereas startIndex is the index of the byte within a value.ExampleLet us now ... Read More

DateTime.IsLeapYear() Method in C#

AmitDiwan

AmitDiwan

Updated on 08-Nov-2019 10:42:32

3K+ Views

The DateTime.IsLeapYear() method in C# is used to check whether the specified year is a leap year. The return value is a boolean, with TRUE if the year is a leap year, else FALSE.SyntaxFollowing is the syntax −public static bool IsLeapYear (int y);Above, y is the year to be checked, ... Read More

DateTime.IsDaylightSavingTime() Method in C#

AmitDiwan

AmitDiwan

Updated on 08-Nov-2019 10:40:37

421 Views

The DateTime.IsDaylightSavingTime() method in C# is used to indicate whether this instance of DateTime is within the daylight saving time range for the current time zone.SyntaxFollowing is the syntax −public bool IsDaylightSavingTime ();ExampleLet us now see an example to implement the DateTime.IsDaylightSavingTime() method −using System; public class Demo {   ... Read More

Delete URLs with specific domains from MySQL database?

AmitDiwan

AmitDiwan

Updated on 08-Nov-2019 10:39:25

346 Views

To delete URLs with specific domains, use DELETE and LIKE clause.Let us first create a table −mysql> create table DemoTable1361     -> (     -> URL text     -> ) ; Query OK, 0 rows affected (0.58 sec)Insert some records in the table using insert command −mysql> ... Read More

DateTime.GetTypeCode() Method in C#

AmitDiwan

AmitDiwan

Updated on 08-Nov-2019 10:38:15

106 Views

he DateTime.GetTypeCode() method in C# is used to return the TypeCode for value type DateTime. The returned value is the enumerated constant, DateTime.SyntaxFollowing is the syntax −public TypeCode GetTypeCode ();ExampleLet us now see an example to implement the DateTime.GetTypeCode() method −using System; public class Demo {    public static void ... Read More

Get current year in MySQL WHERE clause?

AmitDiwan

AmitDiwan

Updated on 08-Nov-2019 10:37:28

818 Views

To get current year, use YEAR() along with CURDATE(). Let us first create a table −mysql> create table DemoTable1360     -> (     -> JoiningYear int     -> )     -> ; Query OK, 0 rows affected (0.51 sec)Insert some records in the table using insert ... Read More

DateTime.GetHashCode() Method in C#

AmitDiwan

AmitDiwan

Updated on 08-Nov-2019 10:36:23

664 Views

The DateTime.GetHashCode() method in C# is used to returns the hash code for this instance. This return value is a 32-bit signed integer hash code.SyntaxFollowing is the syntax −public override int GetHashCode ();ExampleLet us now see an example to implement the DateTime.GetHashCode() method −using System; public class Demo {   ... Read More

Advertisements