Thaifox SQL- Database programming tool for beginners
โปรแกรมนี้สร้างจาก Visual Foxpro ทำเลียนแบบ Test SQL (C#)
Description:
Simple VFP database tool for beginners
Learn SQL command with Native DBF, ODBC, OLEDB
Developer Tool:
Visual Foxpro 9 (Service Pack 2)
Download:
https://drive.google.com/drive/folders/1aBfGpjmCrt3mIXGmbNrg4eu0YmIkSqqQ
วิธีใช้งาน

Description:
Simple VFP database tool for beginners
Learn SQL command with Native DBF, ODBC, OLEDB
Developer Tool:
Visual Foxpro 9 (Service Pack 2)
Download:
https://drive.google.com/drive/folders/1aBfGpjmCrt3mIXGmbNrg4eu0YmIkSqqQ
วิธีใช้งาน
- กำหนดวิธีการเชื่อมต่อคือ DBF, ODBC หรือ OLEDB
- ระบุข้อความการเชื่อมต่อ (Connection String)
- DBF คือโฟลเดอร์หรือตำแหน่งที่เก็บไฟล์ *.dbf เช่น Data\Tastrade เป็นต้น
- ODBC ตัวอย่าง Driver={Microsoft Access Driver (*.mdb)};DBQ=Data\Northwind.mdb
- OLEDB ตัวอย่าง Provider=Microsoft.Jet.OleDb.4.0;Data Source=Data\Northwind.mdb
- ทดสอบการเชื่อมต่อ (Test Connection)
- เขียนคำสั่ง SQL
- แท็บ Query คือ คำสั่ง SELECT ผลลัพธ์แสดงในตารางด้านล่าง
- แท็บ NonQuery คือ คำสั่ง INSERT, UPDATE และ DELETE
- รันคำสั่ง SQL Execute
ตัวอย่าง DBF
ตัวอย่าง ODBC
Driver={Microsoft Access Driver (*.mdb)};DBQ=Data\Northwind.mdb
ตัวอย่าง OLEDB
Provider=Microsoft.Jet.OleDb.4.0;Data Source=Data\Northwind.mdb

ตัวอย่าง นำข้อมูลไปแสดงเป็น Pivot ในเอ็กเซล
DBF
SELECT YEAR(order_date) year,MONTH(order_date) month,SUM(unit_price*quantity) amount
FROM orditems a JOIN orders b ON a.order_id=b.order_id
GROUP by 1,2
ORDER by 1,2
FROM orditems a JOIN orders b ON a.order_id=b.order_id
GROUP by 1,2
ORDER by 1,2
ODBC หรือ OLEDB
SELECT YEAR(orderdate) AS year, MONTH(orderdate) AS month, SUM(quantity*unitprice*(1-discount)) AS amount
FROM orders a INNER JOIN [order details] b ON a.orderid=b.orderid
GROUP BY YEAR(orderdate),MONTH(orderdate)
ORDER BY 1,2
- รัน SQL Execute
- คลิกปุ่ม CSV หรือ XLS
- เปิดไฟล์ข้อ 2 ด้วยโปรแกรมเอ็กเซล (Excel)
- เลือกช่วงข้อมูลที่เซลล์ A1
- แท็บ Insert > PivotTable
- Column: month
- Row: year
- Values: amount







ความคิดเห็น
แสดงความคิดเห็น