devxlogo

Tip Bank

Improve Your Search Algorithms

A normal practice in implementing a search is to use the “like” operator. As long as you are searching for your keyword in only one column, there will be no

Calculated columns that refer to relationships

The DataSet is a container of multiple DataTables, and it allows to create parent-child relationships between two tables, as shown below: ‘ create a relationship between the Categories and the

RestoreDatabase – Restoring a SQL Server database

‘ Restore the specified database.’ Note: requires Imports System.Data.SqlClient” Example:’ Dim connString As String = “server=(local); user id=sa; password=; ‘ Database=master;”‘ Try’ RestoreDatabase(connString, “MyTestDB”, “D:MyTestDbBackup.bak”)’ Catch ex As Exception’ MessageBox.Show(ex.Message)’

The DataTable’s Compute method

The DataTable class has a method, Compute, that executes SQL-like functions on the rows locally stored in the DataTable. It supports functions such as COUNT, SUM, MIN, MAX, AVG and

DecodeBase64 – Decoding a string from base64

‘ Returns the input string decoded from base64Private Function DecodeBase64(ByVal input As String) As String Dim strBytes() As Byte = System.Convert.FromBase64String(input) Return System.Text.Encoding.UTF8.GetString(strBytes)End Function

EncodeBase64 – Encoding a string to base64

‘ Returns the input string encoded to base64Private Function EncodeBase64(ByVal input As String) As String Dim strBytes() As Byte = System.Text.Encoding.UTF8.GetBytes(input) Return System.Convert.ToBase64String(strBytes)End Function