Examples of Red Books (Three, Four, Five)

Example 3 (using data binding to access the database)
This example did not encounter any problems, all the way to the green light, the following summarizes some knowledge points of this example ;
this example mainly uses the ADO
Data control to link the database
 to access the database in multiple ways:
1) Use ADO Object, by writing code to access the database.
2) Use the ADO
Data control to quickly create a database connection and access the database without writing code.
3) Use the data environment designer to create a data connection to access the database without writing code.




Data Environment Designer: (Date Environment)


provides an interactive design environment for accessing the database.


At design time, you can create Connection and Command objects, write ADO event code, execute Commands, and create aggregate or hierarchical commands.


You can also drag a DataEnvironment object onto a form or report to create data-bound controls.


Why do I change the two textbox properties DataSource and DataField when setting up the form? What is the meaning of properties?


The DataSource property puts back or sets a data source through which a consumer is bound to a database.

The DataField property returns or sets the field name to which the data consumer will be bound.


Example 4 (paging display records)




When this problem occurs, no matter whether it is knocked according to the textbook or replaced by the instance, it cannot be run in the past. The dialog box it pops up is that the user-defined type is not defined. The main reason is that no reference is added. The comment on the instance also states the reason for the error : there is no reference to the ADO object to access the database, so an error is reported. The previous example mentioned how to add and which item to add: Solution : Add "Microsoft ActiveX Data Object [version number, such as 2.8, etc.] Library" in "Project Reference". Parameter type mismatch appears here Compilation error: The subroutine or function is not defined where the meaning of intPage is: the page to be displayed. My mistake here is that I made a typo in the initial use of public variables, and there is less e in ingpage As Integer, so a dialog box that the subroutine or function is not defined will pop up. Learning to debug here is also a big gain! There was another problem in this place. After I found the last bug, I learned to debug it. This bug is much easier to find than the previous one. Finally, I found the error here. When debugging, the empty value is displayed here, and it is obvious that a t is omitted. Sometimes there is a code that is not serious and really wants to slap myself, but I found a mistake and learned a lot, and I think it is worth it. Example 5 (data query) In this example, it took the longest time to find its bug. No matter how to find it, I couldn’t find the problem in the code. I couldn’t find the problem in the code. If the code still doesn't work, it's not a code problem. There are so many errors, mainly because the fifth example or the database of the first example is used. Later, I recreated one according to the method of example 1. The fifth connection database is more than needed before. thing. Summarize:

































































虽说是五个例子,真的学到了不少的东西,从出现了这么多的报错就可以看出我的成长,有时出现了打代码的不认真真想抽自己两巴掌,但找到了错误又学会了很多又觉得这是值得的。


这是一篇写知识点和自己出错的文章,最后我还会好好总结这五个例子里的知识点和他们的练习,相信完成我要做的接下来一步对红皮书实例知识更加巩固了。

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326728016&siteId=291194637