Skip to content

Instantly share code, notes, and snippets.

View karenpayneoregon's full-sized avatar
🎯
Focusing

Karen Payne karenpayneoregon

🎯
Focusing
View GitHub Profile
Imports SpreadsheetLight
''' <summary>
''' Commonly used methods for SpreadSheetLight library.
''' Anytime there are methods that are used over and over again
''' consider placing those methods in this module.
'''
''' To use them simply call the method as this module has
''' public scope in the project it resides or in a class project
''' another main project references.
''' </summary>
@karenpayneoregon
karenpayneoregon / Form1.vb
Created February 25, 2020 12:53
Simple example for interface, INotifyPropertyChanged, data binding
Imports System.ComponentModel
Imports System.Runtime.CompilerServices
''' <summary>
''' Requires two ListBox controls, ListBox1, ListBox2
'''
''' Shows a simple use of a Interface and a simple use
''' of a BindingList. Note by implementing INotifyPropertyChanged and a BindingList
''' we can update a ListBox while without the BindingList the change is not
''' reflected in the second listbox.
'''
@karenpayneoregon
karenpayneoregon / CustomerEntity.vb
Created May 6, 2020 19:58
Read only property for StackOverflow question
Imports System.ComponentModel
Imports System.ComponentModel.DataAnnotations
Imports System.Runtime.CompilerServices
Public Class CustomerEntity
Inherits BaseEntity
Implements INotifyPropertyChanged
Private _customerIdentifier1 As Integer
Private _companyName1 As String
Imports System.IO
''' <summary>
''' Simple extension method to export all checked rows,
''' all columns except for the first column which would be
''' the check box column
''' </summary>
Module DataGridViewExtensions
''' <summary>
''' Export to text file
''' </summary>
@karenpayneoregon
karenpayneoregon / CustomersNorthWind2020_customers.sql
Last active July 10, 2020 14:55
Using NorthWind2020 select customers
SELECT Cust.CustomerIdentifier,
Cust.CompanyName,
Cust.ContactId,
CT.ContactTitle,
C.FirstName,
C.LastName,
Cust.Street,
Cust.City,
Cust.Region,
Cust.PostalCode,
@karenpayneoregon
karenpayneoregon / NorthWind2020_Categories.sql
Created July 10, 2020 14:58
Select categories query suitable for a ComboBox, ListBox etc.
SELECT CategoryID,
CategoryName
FROM NorthWind2020.dbo.Categories;
DECLARE @OrderIdentifier INT= 10248;
SELECT O.OrderID,
O.CustomerIdentifier,
O.EmployeeID,
E.Title + ' ' + E.FirstName + ' ' + E.LastName AS Employee,
O.OrderDate,
O.RequiredDate,
O.ShippedDate,
O.ShipVia,
O.Freight,
@karenpayneoregon
karenpayneoregon / NorthWind2020OrderDetails.sql
Created July 10, 2020 16:11
Get order items by order id
DECLARE @OrderIdentifier INT= 10248;
SELECT p.ProductName,
od.ProductID,
od.UnitPrice,
od.Quantity,
od.Discount
FROM OrderDetails AS od
INNER JOIN Products AS p ON od.ProductID = p.ProductID
WHERE od.OrderID = @OrderIdentifier;
@karenpayneoregon
karenpayneoregon / NorthWind2020Employees.sql
Created July 11, 2020 12:09
Get employees for NorthWind2020
SELECT E.EmployeeID,
E.TitleOfCourtesy,
E.LastName,
E.FirstName,
CT.ContactTitle,
CONVERT(VARCHAR, E.BirthDate, 1) AS BirthDate,
CONVERT(VARCHAR, E.HireDate, 1) AS HireDate,
E.Address AS Street,
E.City,
E.Region,
@karenpayneoregon
karenpayneoregon / NorthWind2020ProductsByCategory.sql
Last active July 11, 2020 12:10
Get products by category for NorthWind2020
DECLARE @CategoryID INT= 2;
SELECT P.ProductID,
P.ProductName,
P.UnitPrice,
P.UnitsInStock,
P.SupplierID,
S.CompanyName AS SupplierName,
C.[Name] AS SupplierCountry
FROM Products AS P
INNER JOIN Suppliers AS S ON P.SupplierID = S.SupplierID