Mono: Database Development

zhaozj2021-02-16  104

Mono: Database Development

This example uses the MySQL test database operation. You need to go to http://sourceforge.net/projects/mysqlnet to download mysql's .NET database driver. This driver requires Sharpziplib, you can get down to http://www.icsharpcode.net/opensource/sharpziplib/default.asp.

After decompression, you need to add Bytefx.Data.dll, Sharpziplib.dll to the project's reference.

The first step is to create a console solution;

Figure 2.9.0

Figure 2.9.1

Increase the reference.

Figure 2.9.2

Figure 2.9.3

Write a business code, here connect this machine's MySQL database, create a field in the TEST database as Name, AGE's Friends table.

Figure 2.9.4

Press F8 to compile, run the program in the terminal to view the output information.

The Mono comes with PostgreSQL .NET driver, we will test with PostgreSQL as an example.

Add to reference:

Figure 2.9.5

Write a business code. The postgreSQL on my machine is just installed. There is only one database template1. Take it as an example, look for table pg_user, and output the user's name:

Figure 2.9.6

Compile F8, run the program in the terminal:

转载请注明原文地址:https://www.9cbs.com/read-11239.html

New Post(0)