1 / 28

Database Design and Development with Visual Basic: Connecting and Manipulating Data

This document outlines the key concepts and practical examples in database design and development using Visual Basic. It covers connecting to a database, executing SQL commands, and manipulating data within the `dbEmployee` database. Key operations include retrieving employee records, inserting new records, and updating existing entries through user input. It serves as a guide for students to develop skills in handling data using ADO with SQL statements, ensuring they understand Data Manipulation Language (DML) principles necessary for effective database management.

meryl
Télécharger la présentation

Database Design and Development with Visual Basic: Connecting and Manipulating Data

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. DBMATRIX Reloaded เอกสารประกอบการบรรยายรายวิชา 204204 การออกแบบและพัฒนาฐานข้อมูล

  2. Visual Basic

  3. Visual Basic

  4. Visual Basic With Database dbEmployee Determine Database Connect to the Database dbEmployee Execute Command SELECT * FROM employee Use Data Close Connection

  5. Visual Basic With Database Determine Database Set conAddress = New ADODB.Connection conAddress.ConnectionString = "PROVIDER=SQLOLEDB;DATA SOURCE=LAB10;UID=user01;PWD=password;DATABASE=dbEmployee"

  6. Visual Basic With Database Connect to the Database conAddress.Open

  7. Visual Basic With Database Execute Command Set rstAddress = New ADODB.Recordset rstAddress.Open "SELECT * FROM employee ORDER BY empname", conAddress, adOpenStatic, adLockOptimistic

  8. Visual Basic With Database Use Data Set DataGrid1.DataSource = rstAddress

  9. Visual Basic With Database Close Connection rstAddress.Close Set rstAddress = Nothing conAddress.Close Set conAddress = Nothing

  10. Visual Basic With Database Determine Database Connect to the Database Execute Command Use Data Close Connection

  11. SQL Statement in Visual Basic

  12. SQL Statement in Visual Basic • SQL_Statement = "SELECT * FROM employee ORDER BY empname WHERE empname LIKE '" & Text1.Text & "'" • SQL_Statement = "INSERT INTO employee (empno, empname, address) VALUES('" & Text1.Text & "','" & Text2.Text & "','" & Text3.Text & "')" • SQL_Statement = "UPDATE employee SET empno='" & Text2.Text & "' WHERE empno = '" & Text1.Text & "'"

  13. SQL Statement in Visual Basic • SQL_Statement = "SELECT * FROM employee ORDER BY empname WHERE empname LIKE '" & Text1.Text & "'"

  14. SQL Statement in Visual Basic • SQL_Statement = "SELECT * FROM employee ORDER BY empname WHERE empname LIKE ‘” & Text1.Text & “’” • SELECT * FROM employee ORDER BY empname WHERE empname LIKE ‘somchai’

  15. SQL Statement in Visual Basic • SQL_Statement = "INSERT INTO employee (empno, empname, address) VALUES('" & Text1.Text & "','" & Text2.Text & "','" & Text3.Text & "')"

  16. SQL Statement in Visual Basic • SQL_Statement = "INSERT INTO employee (empno, empname, address) VALUES('" & Text1.Text & "','" & Text2.Text & "','" & Text3.Text & "')" • INSERT INTO employee (empno, empname, address) VALUES(“0001”, “Somchai”, “111 Univers…”)

  17. SQL Statement in Visual Basic • SQL_Statement = "UPDATE employee SET empno='" & Text2.Text & "' WHERE empno = '" & Text1.Text & "'"

  18. SQL Statement in Visual Basic • SQL_Statement = "UPDATE employee SET empname='" & Text2.Text & "' WHERE empno = '" & Text1.Text & "'" • UPDATE employee SET empname = ‘Somsak’ WHERE empno = ‘0001’

  19. ภาษาสำหรับจัดการข้อมูล Data Manipulation Language (DML)

  20. ภาษาสำหรับจัดการข้อมูล Data Manipulation Language (DML)

  21. ภาษาสำหรับจัดการข้อมูล Data Manipulation Language (DML) book rental member

  22. ภาษาสำหรับจัดการข้อมูล Data Manipulation Language (DML) book rental member

  23. ภาษาสำหรับจัดการข้อมูล Data Manipulation Language (DML) book rental member

  24. ภาษาสำหรับจัดการข้อมูล Data Manipulation Language (DML) member rental r book

  25. ภาษาสำหรับจัดการข้อมูล Data Manipulation Language (DML) SELECT member.name, book.book_name FROM member, rental, book WHERE member.member_id = rental.member_id AND rental.book_id = book.book_id

  26. ภาษาสำหรับจัดการข้อมูล Data Manipulation Language (DML) member rental r book SELECT member.name, book.book_name FROM member, rental, book WHERE member.member_id = rental.member_id AND rental.book_id = book.book_id

  27. ภาษาสำหรับจัดการข้อมูล Data Manipulation Language (DML) SELECT member.name, book.book_name FROM member, rental, book WHERE member.member_id = rental.member_id AND rental.book_id = book.book_id

  28. สอบเก็บคะแนนครั้งที่ 2(5 คะแนน) • ให้นักศึกษาจับคู่ทำการบ้านครั้งที่ 4 ซึ่งจะมีให้ดาวน์โหลดในวันพุธที่ 10 พ.ย. 2547 • นักศึกษาไม่ควรใช้เวลาเกินครึ่งชั่วโมงในการทำ • นักศึกษาที่ลอกคู่อื่นจะถูกดำเนินคดีตามที่อาจารย์สถิตย์โชคและนีโอบัญญติไว้สูงสุด • จันทร์หน้า 15 พ.ย. 2547

More Related