C# 链接MySQL数据库的实现步骤有哪些?

[IT科技类资讯] 时间:2025-11-04 13:17:56 来源:益强IT技术网 作者:域名 点击:159次
C# 链接MySQL数据库的实现步骤有哪些?
复制using MySQL.Data.MySQLClient;   namespace Discuz   {   public partial class _Default : System.Web.UI.Page   {   protected void Page_Load(object sender,数据实现 EventArgs e)   {   if (!Page.IsPostBack)   {   this.Bind();   }   }   public void Bind()   {   string MySQLString = "User Id=dis;pwd=sa;Host=1.2.3.4;Port=6033;Database=dis;Character Set=utf8";   MySQLConnection conn = newMySQLConnection(MySQLString);   conn.Open();   string bb = "SELECT p.author, p.message FROM cdb_threads AS t INNER JOIN cdb_posts AS p ON t.tid = p.tid where t.fid = 34 and digest !=0";   MySQLDataAdapter sda = newMySQLDataAdapter(bb, conn);   DataSet ds = new DataSet();   sda.Fill(ds, "T");   this.GridView1.DataSource = ds;   this.GridView1.DataBind();   conn.close();   }   }   }   1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20.21.22.23.24.25.26.27.

(责任编辑:应用开发)

    相关内容
    精彩推荐
    热门点击
    友情链接