ممكن فكرة الكلاس حتى يتضح المطلوب او تتضح المشكلة؟.
لاني جربت قبل قليل كلاس يرجع نص بنوع الصورة المرسلة من حدث click لزر في الفورم وتم ....هل هذا هو المطلوب؟
public Image getpic(int id) { using (SqlConnection con = new SqlConnection(str)) {
using (SqlCommand cmd = new SqlCommand("", con)) { cmd.CommandText = "select mg from pic where tid="+id+""; if (con.State == ConnectionState.Closed) { con.Open(); } SqlDataReader dr; dr = cmd.ExecuteReader(); if (dr.Read()) { byte[] b = (byte[])dr[0]; MemoryStream ms = new MemoryStream(b); Image img = Image.FromStream(ms); return img; } dr.Close();
if (con.State == ConnectionState.Open) { con.Close(); }