8.2.5 关键概念
MYSQL:MySQL是一种开放源代码的关系型数据库管理系统(RDBMS),使用最常用的数据库管理语言--结构化查询语言(SQL)进行数据库管理。
MySQL是开放源代码的,因此任何人都可以在General Public License的许可下下载并根据个性化的需要对其进行修改。
MySQL因为其速度、可靠性和适应性而备受关注。大多数人都认为在不需要事务化处理的情况下,MySQL是管理内容最好的选择。
C#连接数据库:可以理解为对象的相应行为,在简单的类设计中,可以直接在类声明中,实现所需要的方法代码连接数据库字符串语句(有两种)
SqlConnection conn=new SqlConnection(“server=.;database=数据库名;uid=sa;pwd=sa”);//uid=sa;pwd=sa这是以sqlserver的身份登录
SqlConnection conn=new SqlConnection(“data source=.;Initial Catalog=数据库名;Integrated Security=true”); Integrated secrity=true这是以Windows的身份登录,Initial Catalog是初始目录。
数据库连接帮助类:
MySql.Data.dll提供以下8个类:
MySqlConnection:连接MySQL服务器数据库。
MySqlCommand:执行一条sql语句。
MySqlDataReader:包含sql语句执行的结果,并提供一个方法从结果中阅读一行。
MySqlTransaction:代表一个SQL事务在一个MySQL数据库。
MySqlException: MySQL报错时返回的Exception。
MySqlCommandBuilder: Automatically generates single-table commands used to reconcile changes made to a DataSet with the associated MySQL database.
MySqlDataAdapter: Represents a set of data commands and a database connection that are used to fill a data set and update a MySQL database.
MySqlHelper: Helper class that makes it easier to work with the provider.