DELPHI using dbexpress control to connect MySQL database method

Source: Internet
Author: User

1. Place 4 controls on a form: Sqlconnection1,simpledataset1,datasource1,dbgrid

(Note: If the "Operation not allowed on unidirectional dataset" error occurs for the following reason:).

Find an article on the internet as follows:

error Description: sqlconnection1, Sqlquery1, Datasource1, and dbgrid1 are used when manipulating the database using the Dbexpress control. In sequential connection, an error occurred when setting the DataSource property of DBGrid to the Datasource1 control: "Operation not allowed on unidirectional dataset".

error Reason: because the SQLQuery control is a one-way cursor, the DBGrid control is bidirectional. The two do not match, so the above error message is generated. (Sqldataset, sqltable are one-way)

So DBGrid cannot be connected to a one-way data set.

Workaround:

(1) Swap with simpledataset;

(2) using Sqlquery+datasetprovider+clientdataset+datasource +dbgrid

2. Setting Method:

SQLConnection1:

SimpleDataSet1

(Note this: After you enter the SQL statement, the active property is set to True, and the DBGrid table displays the contents of the database)

At this point, the contents of the database can be displayed.

DELPHI using dbexpress control to connect MySQL database method

Related Article

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.