Set Default Page Setup in ReportViewer

Dim pg As New System.Drawing.Printing.PageSettings()    pg.Margins.Top = 0    pg.Margins.Bottom = 0.25                pg.Margins.Left = 0                pg.Margins.Right = 0 Dim size As System.Drawing.Printing.PaperSize = New PaperSize(“custom”,…

Read More

Get Distinct Maximum Date

Get Distinct Maximum Date Display the latest order of each customers. SELECT A.CustomerID, OrderDate, EmployeeID, ShipperID FROM Orders AS A INNER JOIN(SELECT CustomerID, MAX(OrderDate) AS MaxOrderDate FROM Orders…

Read More

Calculate Total Hour and Minute in SQL

SELECT ((DATEDIFF(minute, ‘2013-06-30 08:30:00.0000000’, ‘2013-06-30 10:45:00.0000000’))/60) AS TotalHour,        ((DATEDIFF(minute, ‘2013-06-30 08:30:00.0000000’, ‘2013-07-30 10:45:00.0000000’))%60) AS TotalMinute The result of the above query is: TotalHour    TotalMinute      …

Read More

Get Windows User Full Name in VB 6

Code in getting the windows user’s fullname. Dim strComputer As StringDim strUserName As StringDim objUser As Object strComputer = “ComputerName”strUserName = “UserNameSet objUser = GetObject(“WinNT://” &…

Read More

Multiple JOIN in MS Access

When you query a multiple join in MSSQL you use this following query:SELECT a.columna, b.columnb, c.columncFROM tablea AS a LEFT JOIN tableb AS b ON a.id = b.id…

Read More

SQL Time Difference

 Subtracting Date Time in MSSQL –YEARSELECT DATEDIFF(year, ‘2012-12-31’, ‘2013-01-01’) –QuarterSELECT DATEDIFF(quarter, ‘2012-01-01 23:59:59’, ‘2013-01-01 00:00:00’) –MonthSELECT DATEDIFF(month, ‘2012-12-31 23:59:59.9999999’, ‘2013-02-01 00:00:00.0000000’) –DaySELECT DATEDIFF(day, ‘2012-12-01 23:59:59.9999999’, ‘2012-12-31…

Read More

VB 6 Send Email

VB Send Email with a HTML Format body Private Sub Command1_Click()Dim EmailList, Mailbod As String, MyfileDim objOutlook As Outlook.ApplicationDim newapp As Outlook.MailItem, objRecip As Outlook.RecipientDim objRWhtm…

Read More