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


วิธีใช้งาน


  1. กำหนดวิธีการเชื่อมต่อคือ DBF, ODBC หรือ OLEDB
  2. ระบุข้อความการเชื่อมต่อ (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
  3. ทดสอบการเชื่อมต่อ (Test Connection)
  4. เขียนคำสั่ง SQL
    • แท็บ Query คือ คำสั่ง SELECT ผลลัพธ์แสดงในตารางด้านล่าง
    • แท็บ NonQuery คือ คำสั่ง INSERT, UPDATE และ DELETE
  5. รันคำสั่ง 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

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
  1. รัน SQL Execute
  2. คลิกปุ่ม CSV หรือ XLS
  3. เปิดไฟล์ข้อ 2 ด้วยโปรแกรมเอ็กเซล (Excel)
  4. เลือกช่วงข้อมูลที่เซลล์ A1 
  5. แท็บ Insert > PivotTable
    • Column: month
    • Row: year
    • Values: amount



ความคิดเห็น

โพสต์ยอดนิยมจากบล็อกนี้

หลายหลายวิธีแสดงข้อมูลด้วย Grid

FAQ: Visual Foxpro Runtime Error

ทำไมรันโปรแกรม EXE แล้วหายแว๊บ !