delphi操作数据库基础(上)(Delphi operation of the database based (on)).doc

上传人:rrsccc 文档编号:11039945 上传时间:2021-06-20 格式:DOC 页数:12 大小:39.50KB
返回 下载 相关 举报
delphi操作数据库基础(上)(Delphi operation of the database based (on)).doc_第1页
第1页 / 共12页
delphi操作数据库基础(上)(Delphi operation of the database based (on)).doc_第2页
第2页 / 共12页
delphi操作数据库基础(上)(Delphi operation of the database based (on)).doc_第3页
第3页 / 共12页
delphi操作数据库基础(上)(Delphi operation of the database based (on)).doc_第4页
第4页 / 共12页
delphi操作数据库基础(上)(Delphi operation of the database based (on)).doc_第5页
第5页 / 共12页
点击查看更多>>
资源描述

《delphi操作数据库基础(上)(Delphi operation of the database based (on)).doc》由会员分享,可在线阅读,更多相关《delphi操作数据库基础(上)(Delphi operation of the database based (on)).doc(12页珍藏版)》请在三一文库上搜索。

1、delphi操作数据库基础(上)(Delphi operation of the database based (on))I. IntroductionSchool lectures Delphi programming - from this period begin, this heart bell to talk about some of their own ideas. From the beginning of the year after received editor manuscripts, heart bell has been pondering how to write

2、 a lecture on the Delphi, but also a reference and learning before several heart seminar style bell. From the topic selection, the heart bell finally chose the database of the topic, a bell is the heart of spare time is mainly to write database procedures, write database familiar; two is the applica

3、tion of database is the most widely used application software, according to statistics about 60% above are associated with the database. I hope this seminar heart bell Delphi database can play a role, so that the reader can through this lecture to learn how to prepare a complete database application

4、, and has been used in their work and study.Now the Delphi database programming books, there are many, the heart does not want to put all sorts of things together to copy, bell moved some information to readers dont want to mess with, such as in accordance with their first database components at las

5、t an example to end the style to write a lecture, properties, methods and events are not exhaustive to explain each database because most of these components, knowledge is duplicate content in the help file, and some of it is not much use, the reader can at any time according to need from the help f

6、ile access, the bell heart dont want to waste precious space. The lecture will take a slightly more complex database application point as the main line, will use the database module and the relevant knowledge with explanation, as far as possible coverage, at the same time, the middle may insert some

7、 small examples or skills to explain some important components of the property, event and method etc. So, if you get used to the writing style of some books, you may feel that this lecture is a little confused in the organization form, but if you follow the lecture and keep on studying, I believe yo

8、u will gain something.The main contents of the lecture plan involved this time is: to the local database, through the introduction of BDE access database through ODBC and ADO; database operation; application of SQL in the database; database installation to make the program; if the time and space wil

9、l allow the introduction of SQL SERVER. This is only a plan which will be adjusted according to readers feedback, editorial requirements, time or layout. This lecture is currently widely used in the enterprise edition of Delphi 5 as the programming environment, although Delphi6.0 has been issued, th

10、e heart bell computer is installed, but may also present with the reader is not too much, if you use 6 or 4 edition, should all be possible, but some database components the assembly position of the panel is not the same. By the way, a lecture heart bell was an amateur Delphi enthusiasts, non profes

11、sional programmers, learning not exhaustive on the Delphi, the more familiar with the content is not very proficient level, so this lecture is not suitable for high level readers, suitable for primary and intermediate level readers, in in the lecture there may be some mistakes, I hope readers can pr

12、omptly pointed out that heart bell can also make other readers to get the correct information at the same time improve.Heart bell as far as possible to explain some key points in detail, so that readers can understand and understand, hope that readers will promptly put forward suggestions and opinio

13、ns, the lecture will be good, do not live up to the editors trust and expectations of readers. X: always ready to accept your comments, suggestions or other questions. Readers of this lecture should have the basic knowledge of the database, such as data tables, fields, fields, types, indexes, and so

14、 on, and should have an initial level of Delphi itself.The following heart bell first talk about how to write a database program.Two, how to write a database program?The heart bell training for non computer majors, have not studied software engineering courses, here only from experience to talk abou

15、t how to write a database program. Of course, some of the experience here also applies to writing other programs.First, first of all, we should make a plan. It can be said is a plan outline, or something, in the scheme first according to their own or customers need to write the main function of clea

16、rance, write in detail, which is the most critical, or find some function due to the prior does not take weeks to re design will be very troublesome in design after the completion, some may need to increase the function to supplement, and some may not leave because interface will cause the original

17、code to do a lot of changes. Next, list the required accessibility and other general features. For example, customers are not familiar with computer and database is generally not presented, such as sorting database compression function, but we should consider these functions in the program design, a

18、s well as the database backup and restore functions; some general functions such as help files, on the procedures and so on, these are generally any software should have. Finally, the database structure is constructed. According to the function, the choice of what kind of database, the database shou

19、ld have several data tables, each table should have much field, type, length, the allowable value of the empty field, whether indexing must write clear.Second. Design the preliminary procedure flow. According to the function, will write out the procedure generally, each function to write the basic p

20、rocedures, mainly for the program to play a guiding role, of course, in the actual process of writing the program there may be many changes, but a basic process will guide you there will not be big the deviation in writing a program.Third. Prepare the required information. Here mainly refers to the

21、data required for programming, according to the program need to complete the function of analysis may need what information of non professional programmers, some data is not likely to remember very firmly, to write programs often need to refer to some information or previously written code, to find

22、them all to put. In a special folder (electronic version) or on the desk (paper medium class), in order to need to timely access to. Of course, if the information provided by the customer needs to be used in programming, of course, be prepared. Also, consider whether there are some features that can

23、 be done alone by the programming software itself. You need to use third party components or other support tools, and you also need to have these components and tools ready.Fourth 、 design initial interface.According to the function, the design of a general interface in the paper, considering the me

24、nu, toolbar, status bar may be used, using a separate window or MID window interface, there is no need to be detailed interface, because in the actual writing process according to the need for intermediary often adjust, here is just a design contour.Fifth 、 analysis difficulties and solutions. Even

25、for a programmer, writing a program can run into some difficult areas. In order to successfully complete the program design, the best according to the required functions and procedures of the program analysis, to find out some difficulties according to their own knowledge and skills, and find the so

26、lution. For example, for more complex queries, might use a SQL query is not required, you need to analyze how to perform this function, is used to realize the temporary data tables, if you need to use the temporary table, then how to export the data to the table, so if there is a SQL statement can n

27、ot write, then immediately check the information to see how to achieve, it is best to find a temporary database to write a few lines of code check to see whether it can solve, if solved, can be used as data storage backup code. So through the analysis, all may become difficult place to find out and

28、found a solution, in the preparation process after the program may not up to one degree, should also be relatively smooth, rather than a difficult encounter several days to solve the stop is better in programming! The heart bell likes to write a program and can accomplish a function in one breath. T

29、his way of thinking is smooth and efficient. If the middle is interrupted, there will be no mood. Of course, this is only a habit of the bell, and some readers may not like it.Sixth. Start writing programs. After the above preparation work should be said here, long march has taken 1/3, or halfway is

30、 not exaggerated. Because of the clear process flow, the basic sufficient information, and the difficulties we may encounter, we have found a solution. What are we afraid of? The prepared more fully, even after the compiling of the procedure may also encounter some difficulties, but after all, not a

31、 lot of obstacles, we need is to take a chunk of time, Jingxiaxinlai conscientiously in accordance with the plan and process to write program. This illustrates a point in the writing process before should first establish a blank database, of course, can also establish a database in the design, can a

32、lso be after the completion of the five step in front of the formal written procedures before the establishment of the blank database.Some suggestions for writing the program: because the interactive function more database programs and users, users need to input a lot of data, so we must fully consi

33、der the error handling procedures, the user input errors may occur should be fully considered in the program and try to give tips, check the input data in preservation, to prevent some illegal the data stored in the database, statistics, query result after error. Its not easy to write a very robust

34、program. From the experience of writing database programs by heart bell, a great deal of effort is devoted to preventing mistakes and enabling programs to be robust.In general a function code immediately after debugging through, write another function of the code, this code can prevent are written a

35、fter debugging may influence each other and get clear bring what part of the code in question. The key parts of the code should be annotated, in case you dont know how it was written in the future. The code will make a backup in case of a disaster, why not timely backup code with deep hatred and res

36、entment.About how to write a database program, lets talk about so many, later in the lecture will also talk about some examples, here is the reference for a few suggestions.Three, Delphi is how to operate the database?Lets take a quick look at how Delphi accesses databases. Delphi database operation

37、 is mainly using BDE (database engine) to carry out, of course through other ways to bypass the BDE direct access to the database in the Delphi can be realized, however, for the local database, through the BDE data access efficiency is very high. If the local database can operate it, write network d

38、atabase is also very easy to use, for ordinary readers, write network database as single opportunity or a local database, so the focus of this lecture or to the local database.BDE is the abbreviation of Borland Database Engine, which is the intermediate agent for dealing with users and databases. In

39、 fact, the application is through data access components and BDE connections, and then BDE access to the database to complete the operation of the database, not directly operate BDE. In this way, users only need to care about data components without having to deal directly with BDE. Database compone

40、nts are mainly data access components and data control components, and their relationship to the database can be represented by the following schematic diagram:User vs. data control component vs. data access components vs. BDE vs. databaseAlmost all types of databases are currently available through

41、 BDE. Lets take a brief look at the commonly used database components.(1) data access components (Data, Access, Component)Data access components panel Data Access components on the page, here we introduce Table, Storedproc, Query and three components are also referred to as a data set for components

42、, and database connection, the reader can be regarded as the component of database, their operation can be considered the operation of the database.The DataSource component is the connection medium between the data set component and the data control component. The data control component is the inter

43、face that the user operates the data in the database. It can only be connected with the data set component by DataSource, so that the data can be used to display, modify and other operations.The Table component is to access the data in the database through the BDE database engine, and user operation

44、 of the database such as add delete modify and transfer back to the database through the BDE, this is a very important component.The Query component uses the Structured Query Language to manipulate the database through BDE, which is basically the same as what the Table component does, but only with

45、SQL,Is one of the important components.The Storedproc component operates through the BDE to the server database, which is commonly used as a client / server structure for database applications.The DataBase component is typically used to build remote database servers - the connections between client

46、/ server structure database applications and databases.Session components are used to control database applications and database connections, primarily for complex functions such as multithreaded database programming.The BatchMove component is used for bulk data transfer, replication, and so on.The

47、UpdateSQL component is dedicated to read-only databases, which are used to cache database updates.The NestedTable component BDE operation by nested databases (a database as a field stored in another database), and similar to the Table component, the heart bell didnt use nested database, so this comp

48、onent does not have any experience. W(two) data control component (Data, Control, Component)A data control component can also be called a data display component or a data browsing component. Their main function is to cooperate with data access components for users to browse data, edit and other oper

49、ations. The data control component is on the DataControl page on the component board, and consists of 15 components. They are: DBGrid components, DBNavigator components, DBText components, DBEdit components, DBMemo components, DBImage components, DBListbox components, DBComboBox components, DBCheckBox components, DBRadioGroup components, DBLookupListBox components, DBLookupComboBox components, DBRichEdit co

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 社会民生


经营许可证编号:宁ICP备18001539号-1