string road = Application.StartupPath; int index = road.LastIndexOf("bin"); string roadsub = road.Substring(0, index); string roadNew = roadsub + "Resources\\Me.jpg"; System.IO.FileStream fs = new System.IO.FileStream(roadNew, FileMode.OpenOrCreate, FileAccess.Read); byte[] fileByte = new byte[fs.Length]; fs.Read(fileByte, 0, (int)fs.Length); int j = -1; string sqlcommandText = @"insert into Picture (PContent)values(@pcontent)"; j = SqlHelper.ExecuteNonQuery(sqlcommandText, new SqlParameter("@pcontent", SqlDbType.Image) { Value = fileByte});
|