C# Code Snippets

C# Code Snippets

C# Code Snippets

Collection of C# code snippets

Recent articles in C# Code Snippets

Recent articles in C# Code Snippets

  • C# Code Snippet - Insert/Update Image To SQL Server. (C-Sharp) C# code snippet connects to SQL server and executes SQL statement and update/insert binary image data in database table. InsertUpdateImage update/insert image into database using open database connection, insert/update SQL statement, binary image and image format.
  • C# Code Snippet - Get Identity Column Value from SQL Server. (C-Sharp) C# code snippet connects to SQL server and executes SQL statement and returns the identity value. ExeSQLReturnLong execute SQL statement using ExecuteScalar method and return identity value as a long. ExeSQLReturnObject execute SQL statement using ExecuteScalar method and return identity value as an object.
  • C# Code Snippet - ExecuteNonQuery against the SQL Server Database. (C-Sharp) C# code snippet connects to SQL server and executes a SQL statement and returns the number of rows affected. ExecuteNonQuery returns number of rows affected using open database connection and SQL statement.
  • C# Code Snippet - Check Record Exists in SQL Server Database. (C-Sharp) C# code snippet connects to SQL server and executes SQL statement to determine whether the given record exists in the database. RecordExists returns logical (True/False) using open database connection and SQL statement.
  • C# Code Snippet - Get Image from sql server. (C-Sharp) C# code snippet connects to SQL server and executes SQL statement and returns the Image data. ScalarToImage returns an Image using open database connection and SQL statement.
  • C# Code Snippet - Get Scalar using open connection. (C-Sharp) C# code snippet connects to SQL server and executes SQL statement and returns the first column of the first row in the result set returned by the query as a object. ExecuteScalar returns an object using open database connection and SQL statement.
  • C# Code Snippet - Get XmlReader using open connection. (C-Sharp) C# code snippet connects to SQL server and executes SQL statement and return XmlReader. ExecuteXmlReader returns XmlReader using open database connection and SQL statement.
  • C# Code Snippet - Get DataTable using open connection. (C-Sharp) C# code snippet connects to SQL server and executes SQL statement and return DataTable. GetDataTable returns DataTable using open database connection and SQL statement.
  • C# Code Snippet - Get First Row As Object Array From SqlDataReader. (C-Sharp) C# code snippet execute a SQL statement using open database connection and return all the columns data in SqlDataReader for first row. GetSqlDataReaderFirstRow execute and close SqlDataReader and returns first data row as a dictionary object array.
  • C# Code Snippet - Get Data From SqlDataReader using open connection. (C-Sharp) C# code snippet connects to SQL server and executes SQL statement and return SqlDataReader. GetSqlDataReader returns SqlDataReader using open database connection and SQL statement.
  • C# Code Snippet - Get Data From SqlDataReader. (C-Sharp) C# code snippet connects to SQL server and executes SQL statement and return SqlDataReader. FunctionSqlDataReader returns SqlDataReader for given database connection string and SQL statement.
  • C# Code Snippet - Remove White Spaces. (C-Sharp) C# code snippet to remove all white spaces from a string. TrimWhiteSpace strip all white spaces from a given.
  • C# Code Snippet - Remove HTML Tags. (C-Sharp) C# code snippet to remove all HTML TAGS from a string. StripHTML strip all HTML tags from a given string and return plain text.
  • C# Code Snippet - Extract Numeric values. (C-Sharp) C# code snippet to extracts all the numeric values from a string. ExtractNumbers returns string array of numeric values successful matches by iteratively applying a regular expression pattern to the input string.
  • C# Code Snippet - Extract Emails. (C-Sharp) C# code snippet to extracts all the Emails from a string. ExtractEmails returns string array of Emails successful matches by iteratively applying a regular expression pattern to the input string.
  • C# Code Snippet - Extract URLs. (C-Sharp) C# code snippet to extracts all the URLs from a string. ExtractURLs returns string array of URLs successful matches by iteratively applying a regular expression pattern to the input string.
  • C# Code Snippet - Validate whole number. (C-Sharp) C# code snippet to validate given whole number. IsWholeNumber function validates positive integers with zero inclusive. Function return TRUE if valid whole number found, if not function will return FALSE.
  • C# Code Snippet - Validate Integer. (C-Sharp) C# code snippet to validate given integer. IsInteger function validate integer both positive and negative. Function return TRUE if valid integer found, if not function will return FALSE.
  • C# Code Snippet - Validate Email Address. (C-Sharp) C# code snippet to validate given email address. IsValidEmail function validate email address. Function return TRUE if valid email address found, if not function will return FALSE.
  • C# Code Snippet - Returns current UNIX timestamp. (C-Sharp) C# code snippet to return current UNIX timestamp. UnixTimeNow() returns current UNIX timestamp.

Be Social