บทความนี้จะแนะนำวิธีการรับและแสดงข้อมูล mysql ในกล่องข้อความ asp เป็นหลัก เพื่อนๆ ที่ต้องการข้อมูลดังกล่าวสามารถอ้างอิงถึงข้อมูลดังกล่าวได้
คัดลอกรหัสรหัสดังต่อไปนี้:
ใช้ MySql.Data.MySqlClient;
MySqlConnection conn = new MySqlConnection("server=(local);database=abc;uid=;pwd=");
conn.เปิด();
MySqlCommand com = ใหม่ MySqlCommand("select * from tb_xxjj",conn);
MySqlDataReader dr = com.ExecuteReader();
ดร.อ่าน();
TB_xxjj.Text = dr["title"].ToString();
content.Text = dr["เนื้อหา"].ToString();