VB6: Data Access

Source: Internet
Author: User

When VB was first used more than a decade ago, it started from data binding. Later, I began to "disdain" this simple and silly operation and gradually transitioned to SQL statements: almost all database operations are completed using SQL, which is quite self-defeating. Later, I switched to Asp.net, where a large number of databases were accessed on the page, forcing myself to gradually form its own page Switching Module to simplifyCodeQuantity.

Today, I wrote another database.ProgramWe found that with the adodc control, we can quickly implement interaction between data and controls, with almost no code.

The method is simple. After adding adodc, you can configure the connection and query to specify the associated control. Then cancel the connection and query.

Load Code:

Ad. connectionstring = OCN. connectionstring
Ad. recordsource = "select * From mapdata where codenum = '" & codenum &"'"
Ad. Refresh


Add code:

Ad. connectionstring = OCN. connectionstring
Ad. recordsource = "select * From mapdata where 1 = 2"
Ad. Refresh
Ad. recordset. addnew

Update code:

Ad. recordset. Update

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.