Friday, 7 August 2015

Croass Tab Query in Access

Original Table: Production

PDate ItemID ItemName Made_Item Left_Item
------------------------------------------------------------
06/24/15 1 Prod1 4 1
06/24/15 2 Prod2 6
06/25/15 1 Prod1 5
06/25/15 2 Prod2 5 2


CrossTab Production: For Made Items

ItemID ItemName 06/24/15 06/25/15
----------------------------------------------------------
1 Prod1 4 5
2 Prod2 6 5

SQL Query:

--------------

TRANSFORM Sum(Production.[Made_Item]) AS SumOfMade_Item
SELECT Production.[ITemID], Production.[ItemName], Sum(Production.[Made_Item]) AS [Total Of Made_Item]
FROM Production
GROUP BY Production.[ITemID], Production.[ItemName]
PIVOT Format([PDate],"Short Date");

Tuesday, 4 August 2015

How to import Data from access 2007 (accdb) to SQL Server 2008

Step by Step to import Data to SQL Server

1. Right Click on the specific database and Choose import from Tasks
2. 

3. Select Microsoft Office 12.0 Access Database Engine OLEDB Provider

4. Click Properties and enter Datasource

5. Choose the Destination

6. Then Specify Table Copy or Query and Select the specific tables and views.
7. After you may execute by choosing Execute immediately.





Monday, 3 August 2015

How to get Value of CurrentCell of Datagridview when user click

Dim s As System.Drawing.Point

s = me.dataGridView.currentCellAddress

dim id as string

'By Column index
id = me.dataGridView.item(0,s.Y).value.toString

OR

'By Column Name
id = me.dataGridView.item("ID",s.Y).value.toString

How to Sort Data by Column in Datagridview


 'sort by Column(1)
        Me.dataGridView.Sort(Me.dataGridView.Columns(1), System.ComponentModel.ListSortDirection.Ascending)