Easy browsing of database records in Visual C #

Source: Internet
Author: User

With Delphi or VB programming, in the database to operate the records, often used a name called the Data Navigator component, through this component, can be very convenient for the implementation of the data table has been bound to this component to browse the records. Is there such a component in Visual C #? The answer is no. However, because Visual C # has powerful database processing capabilities, it is easier to do a program similar to this component. This article is to introduce the process of the specific production of this program.

First, the main functions of the program introduction:

The program opens the Book data table in the local acess database (Sample.mdb) and then puts the

The field is bound to the text box provided by the program, and is displayed. Through the program's four buttons "first record", "Tail record", "previous", "next", to achieve the book data table browsing. The running interface of the program is as follows:

Second, the program design and operation of the environment settings:

(1) Windows 2000 Server Edition

(2) Microsoft acess Data Component 2.6 (MADC 2.6)

Third, the programming difficulty and should pay attention to the question:

(1) How to implement the data table in a text box to display the field:

If you assign the value of a field directly to a text box, when you use the Next button to browse the data record, the value of the text box will not change. How to make a text box dynamically display the value of a field based on the record pointer in the datasheet is one of the key and difficult points of this article.

This article implements the dynamic display of field values by binding the value of the field in the datasheet to the Text property of the TextBox. Implement this process to use the DataBindings property of the text box and the Add method in it? creak Kuimo bending their heads ㄈ? The name of the text component. Databindings.add ("Text", DataSet object, data table and field name);

In the program specific as follows:

T_bookid. Databindings.add ("Text", myDataSet, "Books.bookid");

This allows you to implement the field values to display based on the record pointer.

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.