Apr 4, 2012 - NET with Examples in Visual Basic. Press.VB.NET.Step.By.Step.[1.55.MB_www.netz.ru].rar MYSQL/. Using UML Data Modeling.pdf R.Jennings - Expert One-on-One Visual Basic 2005 Database Programming. Contoh Program Java NetBeans untuk Tugas Akhir dan Skripsi.pdf Desain Program. Under construction Pengetahuan Dasar Koneksi VB.Net dan Database MYSQL untuk memahami bagaimana C# atau VB.net dihubungkan dengan data base anda bisa baca artikel ttg ADO.Net Karena Net Framework tdk menyediakan data provider untuk database MYSQL maka untuk menghubungkan VB.Net dengan Database MYSQL kita membutuhkan mysql connector untuk aplikasi.NET (C# atau VB.Net.
This is a Visual Basic tutorial for the MySQL database. It covers the basics of MySQL programming with Visual Basic. In this tutorial, we use the Connector/Net driver. This driver is based on the ADO.NET specification.The examples were created and tested on Ubuntu Linux. There is a similarMySQL C# tutorial, MySQL Perl tutorial and SQLite Visual Basic tutorial on ZetCode.
If you need to refresh your knowledge of the Visual Basic language, there is a full Visual Basic tutorial on ZetCode.
About MySQL database
MySQL is a leading open source database management system. It is a multi user, multithreaded database management system. MySQL is especially popular on the web. It is one of the parts of the very popular LAMPplatform consisting of Linux, Apache, MySQL, and PHP. Currently MySQL is owned by Oracle.MySQL database is available on most important OS platforms. It runs on BSD Unix, Linux, Windows, or Mac OS. Wikipedia and YouTube use MySQL. These sites manage millions of queries each day. MySQL comes in two versions: MySQL server system and MySQLembedded system.
Before we start
We need to install several packages to execute the examples in this tutorial:
The libmysql6.1-cil is the MySQL database connector for CLI. It iswritten in C# and is available for all CLI languages. C#, Visual Basic, Boo and others.
From the technical point of view, we need a DLL. On my system (Ubuntu Lucid Lynx), itwas located under the above path. We need to know the path to the DLL library.To compile our examples.
If you don't already have MySQL installed, we must install it.
This command installs the MySQL server and various other packages. While installing the package, we are prompted to entera password for the MySQL root account.
Next, we are going to create a new database user and a new database. We use the
We check if the MySQL server is running. If not, we needto start the server. On Ubuntu Linux, this can be donewith the
We use the mysql monitor client application to connect to the server. We connect to
the database using the root account. We show all availabledatabases with the
We create a new
We create a new database user. We grant all privileges to this userfor all tables of the
If the following program runs OK, then we have everythinginstalled OK. We check the version of the MySQL server.
We connect to the database and get some info about the MySQL server.
We import the elements of the MySQL data provider.
This is the connection string. It is used by the data providerto establish a connection to the database. We specify the databasename, host, user name and password.
This line opens the connection.
Here we print the version of MySQL using the
In case of an exception, we print the error message to theconsole.
We compile our example. A path to the MySQL connector DLLis provided.
This is the output of the program on my system.
A more complex program follows.
We check for the version of the MySQL database. This time usingan SQL query.
This is the SQL
There are queries which return only a scalar value. In ourcase, we want a simple string specifying the version of thedatabase. The
Same result as in the previous example.
Creating and populating tables
Next we are going to create database tables and fill themwith data. These tables will be used throughout this tutorial.
We have a
We use the source command to execute the
In the following example, we are going to insert a new authorinto the
We add a new author to the
Here we create a prepared statement. When we write prepared statements, we use placeholders instead of directly writing the values into the statements. Prepared statements are faster and guard against SQL injection attacks. The
A value is bound to the placeholder.
The prepared statement is executed. We use the
We have a new author inserted into the table.
Retrieving data with MySqlDataReader
We get all authors from the
To create a
Always call the
This is the output of the example.
Next we will show, how to print column headers with the datafrom the database table.
In this program, we select authors from the
This is the SQL statement which joins authors with theirbooks.
We create a
We get the names of the columns with the
We print the data that was returned by the SQL statementto the terminal.
Ouput of the program.
DataSet & MySqlDataAdapter
We print the authors from the
We create and fill the
We get the table called
We write the data to an XML file.
We display the contents of the
In the next example, we are going to bind a table to a Winforms
In this example, we bind a
These two namespaces are for the GUI.
We will display the data from the
We bind the
To compile the example, we must include two DLLs. The DLL for the Winforms and the DLLfor the MySQL connector.
The MySQL database has different types of storage engines. The most common are the MyISAM and the InnoDB engines. The MyISAM is the default one. There is a trade-off between data security and database speed. The MyISAM tables are faster to process and they do not support transactions. On the other hand, the InnoDB tables are more safe against the data loss. They support transactions. They are slower to process.
In this program, we want to change the name of the authoron the first row of the
We begin a transaction.
The third SQL statement has an error. There is no Titl column in thetable.
If there is no exception, the transaction is committed.
In case of an exception, the transaction is rolled back. No changes are committed to the database.
An exception was thrown. The transaction was rolled back andno changes took place.
However, without a transaction, the data is not safe.
We have the same example. This time, without the transaction support.
An exception is thrown again. Leo Tolstoydid not write Martin Eden. The data is corrupted.
This was the MySQL Visual Basic tutorial, with MySQL Connector. You might be also interested in MySQL C API tutorial,MySQL Python tutorial or MySQL PHP tutorial.