Friday, May 13, 2016

MSSQL - How to convert DateTime to VarChar.

The below query convert DateTime to VarChar.
If you execute it, you can understand easily.


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
SELECT 10, 'mm-dd-yy', CONVERT(VARCHAR, GETDATE(), 10)
UNION
SELECT 11, 'yy/mm/dd', CONVERT(VARCHAR, GETDATE(), 11)
UNION
SELECT 12, 'yymmdd', CONVERT(VARCHAR, GETDATE(), 12)
UNION
SELECT 23, 'yyyy-mm-dd', CONVERT(VARCHAR, GETDATE(), 23)
UNION
SELECT 100, 'mon dd yyyy hh:miAM(PM)', CONVERT(VARCHAR, GETDATE(), 100)
UNION
SELECT 101, 'mm/dd/yyyy', CONVERT(VARCHAR, GETDATE(), 101)
UNION
SELECT 102, 'yyyy.mm.dd', CONVERT(VARCHAR, GETDATE(), 102)
UNION
SELECT 103, 'dd/mm/yyyy', CONVERT(VARCHAR, GETDATE(), 103)
UNION
SELECT 104, 'dd.mm.yyyy', CONVERT(VARCHAR, GETDATE(), 104)
UNION
SELECT 105, 'dd-mm-yyyy', CONVERT(VARCHAR, GETDATE(), 105)
UNION
SELECT 106, 'dd mon yyyy', CONVERT(VARCHAR, GETDATE(), 106)
UNION
SELECT 107, 'Mon dd, yyyy', CONVERT(VARCHAR, GETDATE(), 107)
UNION
SELECT 108, 'hh:mm:ss', CONVERT(VARCHAR, GETDATE(), 108)
UNION
SELECT 109, 'mon dd yyyy hh:mi:ss:mmmAM(PM)', CONVERT(VARCHAR, GETDATE(), 109)
UNION
SELECT 110, 'mm-dd-yyyy', CONVERT(VARCHAR, GETDATE(), 110)
UNION
SELECT 111, 'yyyy/mm/dd', CONVERT(VARCHAR, GETDATE(), 111)
UNION
SELECT 112, 'yyyymmdd', CONVERT(VARCHAR, GETDATE(), 112)
UNION
SELECT 113, 'mon yyyy hh:mi:ss:mmm (24h)', CONVERT(VARCHAR, GETDATE(), 113)
UNION
SELECT 114, 'hh:mi:ss:mmm (24h)', CONVERT(VARCHAR, GETDATE(), 114)
UNION
SELECT 120, 'yyyy-mm-dd hh:mi:ss (24h)', CONVERT(VARCHAR, GETDATE(), 120)
UNION
SELECT 121, 'yyyy-mm-dd hh:mi:ss.mmm (24h)', CONVERT(VARCHAR, GETDATE(), 121)
UNION
SELECT 126, 'yyyy-mm-ddThh:mi:ss.mmm', CONVERT(VARCHAR, GETDATE(), 126)

How to get MSSQL's tables, view and column information.

We can take a look at MS-SQL's the tables, the views and the columns by below sql query.


1
2
3
4
5
6
7
8
-- Tables Information
SELECT * FROM INFORMATION_SCHEMA.TABLES 

-- View  Information
SELECT * FROM INFORMATION_SCHEMA.VIEWS

-- Column  Information
SELECT * FROM INFORMATION_SCHEMA.COLUMNS

Thursday, May 12, 2016

How to create a context menu in WPF.

It is the way creating a ContextMenu in WPF.

1. Select a window on the design UI of the your project.


2. Select a ContextMenu item on the combo box of the window's a ContextMenu property.

※ You can check a added Window.ContextMenu tag on the XAML, look like the below image.

3. Display the properties of the ContextMenu when selecting a ContextMenu tag.
 ※ You can select the ContextMenu object on the Document Outline.

4. Open Collection Edition Items window, when click a button of the ContextMenu's Items property.

5. MenuItem is added when click Add button.
 ※ You can check a added MenuItem tag on the XAML, look like the below image.

6. If you run your project and click a right button of a mouse, you can see the context menu on the run window.



Wednesday, May 4, 2016

Creating WPF Project on Microsoft Visual Studio

It is very easy to create WPF project on Microsoft Visual Studio.

1. Click File > New > Project menu.


2. Click Ok button after selecting WPF Application, writing Name/Location/Solution name.

3. Creating WPF Application Project.

4. You can add the controls on the Window.

5. Below image is the running application.