21
Answers

Retrieve image path from MYSQL and display one by one, Please help!

zhang

zhang

14y
6.5k
1
I have saved all the image path in mysql, just like this..(MYSQL is in LINUX system) No name 1 /root/images/baidu.gif 2 /root/images/train.gif 3 /root/images/flower.gif 4 ....... 5 ........ I want to retrieve these path and display the images one by one on the winform MySql.Data.MySqlClient.MySqlConnection conn; string myConnectionString; myConnectionString = "server=11.11.11.11;uid=root;" + "pwd=;database=image;"; BindingSource binds = new BindingSource(); conn = new MySql.Data.MySqlClient.MySqlConnection(); conn.ConnectionString = myConnectionString; conn.Open(); MySqlDataAdapter da = new MySqlDataAdapter("select * from spad", conn); DataSet ds = new DataSet(); da.Fill(ds, "spad"); string loadPic = "SELECT iname from spad"; string fullpath = string.Format("\\root\\images\\{0}", loadPic); this.pictureBox1.Image = Image.FromFile(fullpath); conn.Close(); What should I do now? Thanks very much!!!
Answers (21)