简体   繁体   中英

delphi and mysql DB help

I want to create an application for my friends ,Its like a slam book

I want like this

  1. in nameditbox when i entered name it has to fetch data from database and have to display in respected fields

example : nick name editboz :nick number:1111

2.moreover i want to add to database new entry from my application by clicking add button

  1. is it possible to edit already existed friends name details ?

I never worked with mysql (even i dont know much ), and i never worked in delphi in accordance with mysql ,not normal dlephi though .

is there any already done project ?if yes please link me i want to learn hope some one can help me in this thanks in advance

I have to say I haven't tried this with MySQL, however hope this helps.

For part 1 of your question:

I suggest the easiest way is to use the free MySQL ODBC driver from http://dev.mysql.com/downloads/connector/odbc/5.1.html

Delphi supports connecting using ODBC (Open Database Connectivity). Essentially, Delphi doesn't know about any of the particular features of the MySQL database, but knows about a smaller set of features common across the majority databases.

If you can get this ODBC driver to connect to MySQL, then you will be able to look at all of the good examples on the Internet and in the supplied Delphi help files showing you how to:

  • Create an ODBC data source in Windows ODBC Manager.
  • Open a TDatabase connection to the MySQL ODBC data source
  • Connect a TTable to a TDatabase
  • Connect a TDataSource to a TTable
  • Connect a TDBEdit to a TDataSource

You will need to learn yourself how to connect these to a particular table in your MySQL database.

Connecting these components together like this should give you a working example for what you are trying.

You should find lots of good tutorials showing you how to connect to an ODBC database on the Internet.

For part 2 of your question:

Once you have done part 1, reaching part 2 is a small step from there.

  • Connect a TDBNavigator to the TDataSource.

This will enable you to navigate the table of data and will enable an add/edit/delete feature for the table allowing a new row, deletion of a row and editing of a row.

Best of luck with this.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM