<< Chapter < Page Chapter >> Page >
Mục tiêu: Chương này giới thiệu về một số khái niệm trong lập trình cơ sở dữ liệu với VB, những vấn đề cần thiết khi thiết kế các ứng dụng truy cập cơ sở dữ liệu.

Học xong chương này, sinh viên phải nắm bắt được các vấn đề sau:

- Một số khái niệm khi lập trình cơ sở dữ liệu trong VB.

- Phân biệt DAO, RDO, ADO.

- Sử dụng môi trường phát triển VB để tương tác với cơ sở dữ liệu.

Kiến thức có liên quan:

- Câu lệnh SQL để truy vấn dữ liệu.

Tài liệu tham khảo:

- Microsoft Visual Basic 6.0 và Lập trình Cơ sở dữ liệu - Chương 18, trang 447 - Nguyễn Thị Ngọc Mai (chủ biên), Nhà xuất bản Giáo dục – 2000.

Cơ sở dữ liệu

Khái niệm

Cơ sở dữ liệu là một kho chứa thông tin. Có nhiều loại cơ sở dữ liệu, nhưng trong khuôn khổ bài giảng này ta chỉ quan tâm đến các ứng dụng lập trình liên quan đến cơ sở dữ liệu quan hệ.

Một cơ sở dữ liệu quan hệ:

  • Chứa dữ liệu trong các bảng, được cấu tạo bởi các dòng còn gọi là các mẩu tin, và cột còn gọi là các trường.
  • Cho phép lấy về (hay truy vấn) các tập hợp dữ liệu con từ các bảng.
  • Cho phép nối các bảng với nhau cho mục đích truy cập các mẩu tin liên quan với nhau chứa trong các bảng khác nhau.

Bộ máy (engine) cơ sở dữ liệu

Chức năng cơ bản của một cơ sở dữ liệu được cung cấp bởi một bộ máy cơ sở dữ liệu, là hệ thống chương trình quản lý cách thức chứa và trả về dữ liệu.

Chẳng hạn Microsoft Jet là bộ máy cơ sở dữ liệu được sử dụng khi truy cập dữ liệu Access.

Bảng (table) và trường (field)

Các cơ sở dữ liệu được cấu thành từ các bảng dùng thể hiện các phân nhóm dữ liệu. Chẳng hạn, nếu ta tạo một cơ sở dữ liệu để quản lý các tài khoản trong công việc kinh doanh, ta phải tạo một bảng cho Khách hàng, một bảng cho Hóa đơn và một bảng cho Nhân viên. Bảng có cấu trúc định nghĩa sẵn và chứa dữ liệu phù hợp với cấu trúc này.

  • Bảng: chứa các mẩu tin là các mẩu dữ liệu riêng rẽ bên trong phân nhóm dữ liệu.
  • Mẩu tin: chứa các trường. Mỗi trường thể hiện một bộ phận dữ liệu trong một mẩu tin. Ví dụ như mỗi mẩu tin thể hiện một mục trong danh bạ địa chỉ chứa các trường tên và họ, địa chỉ, thành phố, số điện thoại…

Ta có thể dùng chương trình Visual Basic để tham chiếu và thao tác với cơ sở dữ liệu, bảng, mẩu tin và các trường.

Tập mẩu tin (recordset)

Recordset là một cấu trúc dữ liệu thể hiện một tập hợp con các mẩu tin lấy về từ cơ sở dữ liệu. Về khái niệm, nó tương tự như một bảng nhưng có thêm một vài thuộc tính riêng biệt quan trọng.

Các Recordset được thể hiện như các đối tượng. Cũng như các đối tượng khác trong Visual Basic, các đối tượng recordset có các thuộc tính và phương thức riêng.

Truy xuất cơ sở dữ liệu trong Visual Basic 6.0

Visual Basic cung cấp kèm theo nó một bộ máy cơ sở dữ liệu có thể hiểu được dữ liệu của Microsoft Access gọi là Joint Engine Technology (JET). JET là một bộ máy truy cập cơ sở dữ liệu hướng đối tượng và nó là một phần không thể thiếu được của Visual Basic. Phiên bản của JET đi kèm với VB 6.0 là miễn phí nghĩa là VB có thể truy xuất trực tiếp cơ sở dữ liệu của Microsoft Access. Giao diện để VB truy xuất JET có tên là Data Access Objects (DAO).

Questions & Answers

what is defense mechanism
Chinaza Reply
what is defense mechanisms
Chinaza
I'm interested in biological psychology and cognitive psychology
Tanya Reply
what does preconceived mean
sammie Reply
physiological Psychology
Nwosu Reply
How can I develope my cognitive domain
Amanyire Reply
why is communication effective
Dakolo Reply
Communication is effective because it allows individuals to share ideas, thoughts, and information with others.
effective communication can lead to improved outcomes in various settings, including personal relationships, business environments, and educational settings. By communicating effectively, individuals can negotiate effectively, solve problems collaboratively, and work towards common goals.
it starts up serve and return practice/assessments.it helps find voice talking therapy also assessments through relaxed conversation.
miss
Every time someone flushes a toilet in the apartment building, the person begins to jumb back automatically after hearing the flush, before the water temperature changes. Identify the types of learning, if it is classical conditioning identify the NS, UCS, CS and CR. If it is operant conditioning, identify the type of consequence positive reinforcement, negative reinforcement or punishment
Wekolamo Reply
please i need answer
Wekolamo
because it helps many people around the world to understand how to interact with other people and understand them well, for example at work (job).
Manix Reply
Agreed 👍 There are many parts of our brains and behaviors, we really need to get to know. Blessings for everyone and happy Sunday!
ARC
A child is a member of community not society elucidate ?
JESSY Reply
Isn't practices worldwide, be it psychology, be it science. isn't much just a false belief of control over something the mind cannot truly comprehend?
Simon Reply
compare and contrast skinner's perspective on personality development on freud
namakula Reply
Skinner skipped the whole unconscious phenomenon and rather emphasized on classical conditioning
war
explain how nature and nurture affect the development and later the productivity of an individual.
Amesalu Reply
nature is an hereditary factor while nurture is an environmental factor which constitute an individual personality. so if an individual's parent has a deviant behavior and was also brought up in an deviant environment, observation of the behavior and the inborn trait we make the individual deviant.
Samuel
I am taking this course because I am hoping that I could somehow learn more about my chosen field of interest and due to the fact that being a PsyD really ignites my passion as an individual the more I hope to learn about developing and literally explore the complexity of my critical thinking skills
Zyryn Reply
good👍
Jonathan
and having a good philosophy of the world is like a sandwich and a peanut butter 👍
Jonathan
generally amnesi how long yrs memory loss
Kelu Reply
interpersonal relationships
Abdulfatai Reply
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Giáo trình visual basic. OpenStax CNX. Jul 29, 2009 Download for free at http://cnx.org/content/col10777/1.1
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Giáo trình visual basic' conversation and receive update notifications?

Ask