Database Query Core

Source: Internet
Author: User
We often use database query statements when learning databases. The importance of these statements can be imagined. Let me analyze them. TxtSQLselect * fromstudent_Infowherestudent_SetmrcexecuteSQL (txtSQL, MsgText) select * fromstudent_Info)

We often use database query statements when learning databases. The importance of these statements can be imagined. Let me analyze them. TxtSQL = select * from student_Info where student_ID = 'trim (txtSID. Text) 'Set mrc = executeSQL (txtSQL, MsgText) select * from student_Info this sentence is a query

We often use database query statements when learning databases. The importance of these statements can be imagined. Let me analyze them.

txtSQL = "select*from student_Info where student_ID='" & Trim(txtSID.Text) & "'"  Set mrc = executeSQL(txtSQL, MsgText)

Select * from student_Info: Query table

Student_Info where student_ID = '"& Trim (txtSID. text) & "'" is the filtering condition. Trim () is a space before and after removal, txtSID. text control.

Student_ID is equal to the value entered on your control.

ExecuteSQL (txtSQL, MsgText) is obviously executed SQL.

ExecuteSQL is a user-defined function.

Pass the parameter SQL to pass the query statement, and MsgString to pass the query information. Itself is returned as a DataSet object.

It must be an SQL statement. The two parameters txtSQL are the SQL statements used for execution, such as the elect * from table.

The MsgText parameter indicates whether the pop-up box after the SQL statement is executed is successful or failed.

The first sentence is to query the student information table and find the student whose ID is txtSID. Text.

The second sentence means: Execute an SQL statement and pass MsgText as a parameter to return a set-type data.

Column Name:

If I put all the students in our class into a column, the number standing first is 1, The number following 1 is 2, and so on.

The first SQL statement means: I now find a classmate Li Si and tell him to ask him to find out the student whose number is 5.

Then the student will count from 1 to 5 and find the student whose number is 5. TxtSQL is equivalent to Li Si.

However, you can use the index to query the SQL statement of the database. In the database, the number is not counted from 1, 2, 3, 4, and 5 to 5. It is directly found through the index.

Example:

The student I am looking for has a list with student IDs in front of each name. The student ID is called directly, and the student ID is found.

This student ID is equivalent to an index.

I want to find someone from student_info, but the ID of this person must be txtSID. Text

For example, I am looking for someone from 86 students in Class 1, Grade 5. I only need to find one person. The name of this person is Zhang San (txtSID. Text)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.