MySQL是一个非常流行的小型关系型数据库管理系统,2008年1月16号被Sun公司收购。目前MySQL被广泛地应用在Internet上的中小型网站中。由于其体积小、速度快、总体拥有成本低,尤其是开放源码这一特点,许多中小型网站为了降低网站总体拥有成本而选择了MySQL作为网站数据库。
1、phpMyAdmin(http://www.phpmyadmin.net/)

phpMyAdmin是最常用的MySQL维护工具,是一个用PHP开发的基于Web方式架构在网站主机上的MySQL管理工具,支持中文,管理数据库非常方便。不足之处在于对大数据库的备份和恢复不方便。
2、MySQLDumper(http://www.mysqldumper.de/en/)

MySQLDumper使用PHP开发的MySQL数据库备份恢复程序,解决了使用PHP进行大数据库备份和恢复的问题,数百兆的数据库都可以方便的备份恢复,不用担心网速太慢导致中间中断的问题,非常方便易用。这个软件是德国人开发的,还没有中文语言包。
3、Navicat(http://www.navicat.com/)

Navicat是一个桌面版MySQL数据库管理和开发工具。和微软SQLServer的管理器很像,易学易用。Navicat使用图形化的用户界面,可以让用户使用和管理更为轻松。支持中文,有免费版本提供。
4、MySQL GUI Tools(http://dev.mysql.com/downloads/gui-tools/)

MySQL GUI Tools是MySQL官方提供的图形化管理工具,功能很强大,值得推荐,可惜的是没有中文界面。
5、MySQL ODBC Connector(http://dev.mysql.com/downloads/connector/odbc/)

MySQL官方提供的ODBC接口程序,系统安装了这个程序之后,就可以通过ODBC来访问MySQL,这样就可以实现SQLServer、Access和MySQL之间的数据转换,还可以支持ASP访问MySQL数据库。
以上就是我介绍的五个常用的MySQL维护管理工具,如果你知道更好的MySQL工具,请留言和我们分享。
(作者博客:www.williamlong.info
mysql 下载地址
下面的是MySQL安装的图解,用的可执行文件安装的,详细说明了一下!打开下载的mysql安装文件mysql-5.0.27-win32.zip,双击解压缩,运行“setup.exe”,出现如下界面

mysql安装图文教程1

mysql图文安装教程2

mysql图文安装教程3

mysql图文安装教程4

mysql图文安装教程5

mysql图文安装教程6

mysql图文安装教程7

mysql图文安装教程8

mysql图文安装教程9

mysql图文安装教程10

mysql图文安装教程10

mysql图文安装教程11

mysql图文安装教程12

mysql图文安装教程13

mysql图文安装教程14

mysql图文安装教程15

mysql图文安装教程16

mysql图文安装教程17

mysql图文安装教程18

mysql图文安装教程19

mysql图文安装教程20
I have developed a Windows Application in Visual Studio 2008 some years ago and now it has been updated in Visual Studio 2010.
The application connects to a MySQL database and after porting it to VS2010, the IDE does not show the connection to the MySQL in Server Explorer. Also when trying to add the data connection, in the Choose Data Source window it does not show the MySQL Database.The MySQL connector (an older version – 5.2.7.0) was installed and the reference to MySql.Data namespace was added. There were no problems compiling the project, just VS2010 could not see the connector when trying to create a new Data connection.
This is a compatibility problem between VS2010 and MySQL connector. The same problem has been reported also for the MySql Connector/Net 6.2.2.
The problem seems that has been solved with the release of the MySql Connector/Net 6.3.4. But this version has another problem.The MySQL connector does not work on Windows XP, only on Windows 7. In my case I could not install the connector (the installation wizard failed). So solving this problem you could not install the application on Windows XP because it will not find the required connector. This problem has another solution: How to deploy .NET applications that use modules with different version than the development ones
So, in order to connect to a MySql database from VS2010 you need to
- download the latest version of the MySql Connector/NET fromhttp://www.mysql.com/downloads/connector/net/
- install the connector (if you have an older version you need to remove it from Control Panel -> Add / Remove Programs)
- open Visual Studio 2010
- open Server Explorer Window (View -> Server Explorer)
- use Connect to Database button
- in the Choose Data Source windows select MySql Database and press Continue
- in the Add Connection window
- set server name: 127.0.0.1 or localhost for MySql server running on local machine or an IP address for a remote server
- username and password
- if the the above data is correct and the connection can be made, you have the possibility to select the database
If you want to connect to a MySql database from a C# application (Windows or Web) you can use the next sequence:
//define the connection reference and initialize it
MySql.Data.MySqlClient.MySqlConnection msqlConnection = null;
msqlConnection = new MySql.Data.MySqlClient.MySqlConnection(“server=localhost;user id=UserName;Password=UserPassword;database=DatabaseName;persist security info=False”);
//define the command reference
MySql.Data.MySqlClient.MySqlCommand msqlCommand = new MySql.Data.MySqlClient.MySqlCommand();
//define the connection used by the command object
msqlCommand.Connection = this.msqlConnection;
//define the command text
msqlCommand.CommandText = "SELECT * FROM TestTable;";
try
{
//open the connection
this.msqlConnection.Open();
//use a DataReader to process each record
MySql.Data.MySqlClient.MySqlDataReader msqlReader = msqlCommand.ExecuteReader();
while (msqlReader.Read())
{
//do something with each record
}
}
catch (Exception er)
{
//do something with the exception
}
finally
{
//always close the connection
this.msqlConnection.Close();
}
1.Replace(替换字符):
public string Replace(char oldChar,char newChar);在对象中寻找oldChar,如果寻找到,就用newChar将oldChar替换掉。
如:
string st = "abcdef";
string newstring = st.Replace(“a“, “x“);
Console.WriteLine(newstring); //即:xbcdef
public string Replace(string oldString,string newString);在对象中寻找oldString,如果寻找到,就用newString将oldString替换掉。
如:
string st = "abcdef";
string newstring = st.Replace("abc", "xyz");
Console.WriteLine(newstring); //即:xyzdef
2.Remove(删除字符):
public string Remove(int startIndex);从startIndex位置开始,删除此位置后所有的字符(包括当前位置所指定的字符)。
如:
string st = "abcdef";
string newstring = st.Remove(4);
Console.WriteLine(newstring); //即:abcd
public string Remove(int startIndex,int count);从startIndex位置开始,删除count个字符。
如:
string st = "abcdef";
string newstring = st.Remove(4,1);
Console.WriteLine(newstring); //即:abcdf
3.Substring(字符串提取):
public string Substring(int startIndex);从startIndex位置开始,提取此位置后所有的字符(包括当前位置所指定的字符)。
如:
string st = "abcdef";
string newstring = st.Substring(2);
Console.WriteLine(newstring); //即:cdef
public string Substring(int startIndex,int count);从startIndex位置开始,提取count个字符。
如:
string st = "abcdef";
string newstring = st.Substring(2,2);
Console.WriteLine(newstring); //即:cd
4.Trim(清空空格):
public string Trim ():将字符串对象包含的字符串两边的空格去掉后返回。
public string Trim ( params char[] trimChars ):从此实例的开始和末尾移除数组中指定的一组字符的所有匹配项。
如:
string st ="abcdef";
string newstring = st.Trim(new char[] {“a“});//寻找st字符串中开始与末尾是否有与“a“匹配,如有,将其移除。
Console.WriteLine(newstring); //即:bcdef
注:如果字符串为"aaaabcdef",返回依然为bcdef。当移除第一个a时,开始依然为a,继续移除,直到没有。
public string TrimEnd ( params char[] trimChars ):对此实例末尾与指定字符进行匹配,true则移除
public string TrimStart ( params char[] trimChars ):对此实例开始与指定字符进行匹配,true则移除
5.ToLower(转换大小写)
public string ToLower():将字符串对象包含的字符串中的大写全部转换为小写。
6.IndexOf(获取指定的字符串的开始索引)
public int IndexOf (sring field):在此实例中寻找field,如果寻找到,返回开始索引,反之,返回-1。
如:
string st = "abcdef";
int num=st.IndexOf("bcd");
Console.WriteLine(num); //即:1
7.Equals(是否相等)
public bool Equals (string value):比较调用方法的字符串对象包含字符串和参数给出的对象是否相同,如相同,就返回true,反之,返回false。
如: string a = "abcdef";
bool b = a.Equals("bcdef");
Console.WriteLine(b);//即:false
public bool Equals ( string value, StringComparison comparisonType ):比较调用方法的字符串对象包含字符串和参数给出的对象是否在不区分大小写的情况下相同,如相同,就返回true,反之,返回false,第二个参数将指定区域性、大小写以及比较所用的排序规则.
如:
string a = "ABCDEF";
bool b = a.Equals("abcdef",StringComparison.CurrentCultureIgnoreCase);
Console.WriteLine(b);//即:true
8.Split(拆分)
public string[] Split ( params char[] separator ):根据separator 指定的没有字符分隔此实例中子字符串成为Unicode字符数组, separator可以是不包含分隔符的空数组或空引用。
public string[] Split ( char[] separator, int count ):参数count 指定要返回的子字符串的最大数量。
如:
string st = "语文|数学|英语|物理";
string[] split = st.Split(new char[]{“|“},2);
for (int i = 0; i < split.Length; i++)
{
Console.WriteLine(split[i]);
}
注:count不填则全部拆分
public enum StringSplitOptions
成员名称 说明
None 返回值包括含有空字符串的数组元素
RemoveEmptyEntries 返回值不包括含有空字符串的数组元素
如:
string st = "语文|数学||英语|物理";
string[] split = st.Split(new char[]{“|“},StringSplitOptions.RemoveEmptyEntries);
for (int i = 0; i < split.Length; i++)
{
Console.WriteLine(split[i]);
}
将StringSplitOptions枚举和Split()方法联系起来:
1. public string[] Split ( char[] separator, StringSplitOptions options ):options指定StringSplitOptions枚举的RemoveEmptyEntries以省略返回的数组中的空数组元素,或指定StringSplitOptions枚举的None以包含返回的数组中的空数组元
2. public string[] Split ( char[] separator, int count, StringSplitOptions options )
3. public string[] Split ( string[] separator, StringSplitOptions options )
4. public string[] Split ( string[] separator, int count, StringSplitOptions options )
9.Contains(判断是否存在)
public bool Contains(string text):如果字符串中出现text,则返回true,反之false,如果text为("")也返回true。
如:
string st="语文数学英语";
bool b=st.Contains("语文");
Console.WriteLine(b);//true
10.EndsWith,StartsWith(判断字符串的开始或结束)
public bool EndsWith ( string value ):判断对象包含字符串是否以value指定的字符串结束,是则为 true;否则为 false。
public bool EndsWith ( string value, StringComparison comparisonType ):第二个参数设置比较时区域、大小写和排序规则。
public bool StartsWith ( string value ):判断对象包含字符串是否以value指定的字符串开始,是则为 true;否则为 false。
public bool StartsWith ( string value, StringComparison comparisonType ) :第二个参数设置比较时区域、大小写和排序规则。
如:
string st="语文数学英语abc";
bool b=st.EndsWith("英语ABC",StringComparison.CurrentCultureIgnoreCase);//第二个参数忽略大小比较。
Console.WriteLine(b);//true
11.Insert(字符串插入)
public string Insert ( int startIndex, string value ):在指定的字符串下标为startIndex前插入字符串value。返回插入后的值。
如:
string st="语文数学英语abc";
string newst=st.Insert(6,"物理");//注:在指定索引“前”插入。
Console.WriteLine(newst);//即:语文数学英语物理abc
注:作者:岁月苍狼---相博仁 文章来源:hi.baidu.com
虚方法(virtual)
virtual关键字用地修饰方法、属性、索引器或事件声明,并且允许在派生类中重写这些对象。
virtual表示此方法是一个虚方法,override表示要覆盖主线类的虚方法,对方法进行重写。
他们经常一起配合使用,这样就形成了多态。
多态(Polymorphism)
多态是指两个或多个属于不同类的对象,对同一个消息做出不同响应的能力。
多态概念的举例:
●外科医生 cut
●发型师 cut
●演员 cut
当外科医生接收到cut指令时,外科医生会对病人进行手术
当发型师收到cut指令时,发型师会对顾客修剪头发
当演员收到cut指令时,演员会停止表演。
这个就是多态,对同一事件发出不同响应的能力。
使用举例:
using System;
class Employee
{
protected string _name;
public Employee(){}
public Employee(string name)
{
_name=name;
}
public virtual void StartWork()//rivtual常与overrider一起使用
{
Console.Write(_name+"开始工作");
}
}
class Manager:Employee
{
public Manager(string name):base(name){}
//此构造函数调用了基类的构造函数,把string name的name传递到base(name)的构造函数里面
//从而,Manager类里的构造函数会执行Employee中的构造函数
public override void StartWork()
{
Console.WriteLine("给员工下达任务");
}
}
class Secretary:Employee
{
public Secretary(string name):base(name){}
public override void StartWork()
{
Console.WriteLine("协助经理");
}
}
class Test
{
static void Main()
{
Employee[] emp=new Employee[3];
emp[0]=new Manager("tom");
emp[1]=new Secretary("lilly");
emp[2]=new Secretary("mary");
Console.WriteLine("we工作开始!");
foreach(Employee e in emp)
{
e.StartWork();
}
}
}
此代码功能用多态实现有很多好处,例如这样会非常便于维护。我们程序里有员工、经理、秘书,如果再添加
一个成员业务员则只需新增一个关于业务员的类,此类继承至员工类,相关的工作事件可以用override重
载方法实现。
一、声明数级时要在各个元素的类型后面加上一组方括号,例:
int[] intergers;
二、要初始化特定大小的数组,可以使用new关键字,在类型后面的方括号中给出大小。例:
int[] integers=new int[2];
注意:在c语言中声明数组并分配内存空间只需int a[3]即可。而在c#中声明变量int[] integers;,分配内存空间new int[2];
此外,中括号的位置也于c语言不同。c语言中中括号在变量的后面,而c#中中括号在类型的后面。例:
c语言:int a[2];
c#:int[2] a;
三、也可以声明时不初始化,以后动态指定大小。例:
int[] integers;
integers=new int[32];
四、在初始化数组时,不能用变量设置数组应包含多少元素,但是可以给数组长度声明一个常。例:
const int len=3;
string[] s=new string[len];
五、要确定数组大小,可以用length来访问。例:
int arraylength=integers.Length;
Array.Sort(string)数组按正序排列
Array.Reverse逆序排列
六、多维数组
c#支持两数组。第一种是矩形数组。例:
string[,] strings;
第二种多维数组是正交数组
int[][] a=new int[3][];
a[0]=new int[4];
a[1]=new int[2];
a[2]=new int[1];
要声明一个正交三维数组应使用:
int[][][] array;
七、自定义类型数组的声明
public class userinfo
{
string[] a=new string[3];
string[][] b=new string[2][2];
public void printA()
{
System.Console.WriteLine("this is array");
}
}
自定义数组声明:userinfo[] user=new userinfo[3];
委托(delegate)
委托声明定义了一种类型,它用一组特定的参数以及返回类型来封闭方法。对于静态方法,委托对象
封装要调用的方法。对于实例方法,委托对象同时封闭一个实例和该实例上的一个方法。如果您有一
个委托对象和一组适当的参数,则可以用这些参数调用该委托。
委托提供了类似于c++中函数指针的功能,简单的说委托类型就是面向对象函数指针。
不过c++的函数指针只能指向静态的方法,而委托除了可以指向一个静态的函数方法外,还可以指
向对象的实例的方法。而最大的差异在于委托是完全的面向对象,且使用安全的类型,另外委托允许程序员在程序执行时传入
方法的名称,动态的决定预调用的方法。如此的弹性更能让程序员随心所欲的发挥。
委托的本质是一个类,任何可以声明类的地方都可以使用委托。
委托的使用举例:
using System;
delegate void EatDelegate(string food);//委托的声明,返回值及形参要与所指向的函数对应
class MyDelegate
{
static void zsEat(string food)
{
Console.WriteLine("zs eat "+food);
}
static void lsEat(string food)
{
Console.WriteLine("ls eat "+food);
}
static void wwEat(string food)
{
Console.WriteLine("ww eat "+food);
}
static void Main()
{
EatDelegate zs=new EatDelegate(zsEat);
EatDelegate ls=new EatDelegate(lsEat);
EatDelegate ww=new EatDelegate(wwEat);
//方法一
zs("apple");
Console.WriteLine("--------------");
//方法二
EatDelegate eatChain;
eatChain=zs+ls+ww;
eatChain("orange");
Console.WriteLine("--------------");
//方法三
eatChain-=zs;//??zs???
eatChain("banana");
Console.WriteLine("--------------");
//方法四
eatChain+=zs;//???zs???
eatChain("banana");
Console.WriteLine("--------------");
//方法五,匿名方法
/*
* EatDelegate eatChain=null;
* eatChain+=delegate(string food){console.writeLine("zs eat "+food);};
* eatChain("pear");
*/
}
}


