SqlDataSource控件怎么使用MySQL数据库?

解决方案 »

  1.   


    using MySql.Data.MySqlClient; string query = "select * from guestbook";
    MySqlConnection myConnection = new MySqlConnection("server=localhost;user id=root;password=;database=guestbook");
    MySqlCommand myCommand=new MySqlCommand(query,myConnection);
    myConnection.Open();
    myCommand.ExecuteNonQuery();
    MySqlDataReader myDataReader = myCommand.ExecuteReader();
    string bookres="";
    while (myDataReader.Read()==true)
    {
    bookres+=myDataReader["id"];
    bookres+=myDataReader["user"];
    bookres += myDataReader["pass"];
    }
    myDataReader.Close();
    myConnection.Close(); 
      

  2.   

    <asp:SqlDataSource ID="SqlDataSource2" Runat="server" SelectCommand="SELECT DISTINCT [ContactTitle] FROM [Customers]" UPDATECOMMAND="......" DELETECOMMAND="..." INSERTCOMMAND="..." ConnectionString="server=localhost;uid=sa;password=xxx;database=northwind">
    <SELECTPARAMETERS>...</SELECTPARMATERS>
    <UPDATEPARAMETERS>...</UPDATEPARAMETERS>
    <INSERTPARAMETERS>...</INSERTPARAMETERS>
    <DELETEPARAMETERS>...</DELETEPARAMETERS>
      

  3.   

    我也安装了这个插件了,用一楼的方法不方便呀。不能像访问SQL一样,直接选择数据源吗?
      

  4.   

    就直接用DataView控件就可以了!
      

  5.   

    和楼主同样的问题,尝试在Gridvie中绑定MySql的数据源,工具自动添加的选项中没有MySql数据库的,代码尝试个人修改,但是感觉<asp:sqldatasource>这个标签是否支持mysql的..