0

I have a small WPF application which display images to an image box. When I run the program, it throws an error saying that "'Image' does not contain a definition for 'Image' and no accessible extension method 'Image' accepting a first argument of type 'Image' could be found (are you missing a using directive or an assembly reference?)"

Here is my code:

        string CitizenId = "SW001";
        string query = $"SELECT [Idnum],[Photo] FROM [CPhotos].[dbo].[People] WHERE [Idnum] = {CitizenId}";
        SqlCommand sqlCommand = new SqlCommand(query, sqlConnection);
        SqlDataAdapter da = new SqlDataAdapter(sqlCommand);
        DataSet ds = new DataSet();
        da.Fill(ds);
        if (ds.Tables[0].Rows.Count > 0)
        {
            Byte[] byteArray = (byte[])ds.Tables[0].Rows[0]["Photo"];
            MemoryStream ms = new MemoryStream(byteArray);
            imgCitizen.Image = new Bitmap(ms);
        }

Please help me to solve this error.

Xoxo
  • 17
  • 1

0 Answers0