Click here to Skip to main content
15,895,656 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
C#
while (dr.Read())
                   {
                       f_na.Text += dr[ "FirstName"].ToString();
                       L_na.Text = dr["LastName"].ToString();
                       M_na.Text = dr[ "MiddleName"].ToString();
                       PlOD.Text = dr["PlaceOfBirth"].ToString();
                       DOB.Text = dr["DOB"].ToString();
                       EM_ad.Text = dr["EmailAddress"].ToString();
                       Address.Text = dr["Address"].ToString();
                       suite.Text = dr["Suit/Unit"].ToString();
                       Post.Text = dr["PostalCode"].ToString();
                       City.Text = dr["City"].ToString();
                       provi.Text = dr["Province"].ToString();
                       Country.Text = dr["Country"].ToString();
                       gender_M.Text = dr["Gender"].ToString();
                       gender_F.Text = dr["Gender"].ToString();

**I think this code section is gives me No parameter error**
                       byte[] arr = (byte[])dr["Photo"];
   
                       if (arr.Length > 0)
                       {
                           MemoryStream mem = new MemoryStream(arr);
                           pictureBox1.Image = Image.FromStream(mem);
                       }

                   }
                   dr.Close();
                   Connection.Close();


What I have tried:

I have tried

C#
MemoryStream mem = new MemoryStream(arr);
                           pictureBox1.Image = Image.FromStream(mem);


but I'm getting No Parameter Error here is picture example [^]
Posted
Updated 29-Dec-16 3:12am
v2
Comments
[no name] 27-Dec-16 18:20pm    
Seriously? You couldn't type in 4 or 5 little words into your posting? And it's not "no parameter", it's "parameter is invalid". You get to use your debugger and find out which parameter is incorrect, then you can fix it.

 
Share this answer
 
I have used service for getting the Image Data from Dataset, you could get it from Access Query to Dataset and follow the same procedure as did below

DataSet imageds = ServiceImageClient.GetImageData(serviceimagedata);
dataGridView2.DataSource = imageds.Tables[0];

foreach (DataGridViewRow row in dataGridView2.Rows)
{
if (row.Cells["Image_Id"].Value != null)
{
MemoryStream ms = new MemoryStream((byte[])row.Cells["Image"].Value);
System.Drawing.Image Image1 = System.Drawing.Image.FromStream(ms);
string sMainImagePath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\foldername";
Image1.Save(sMainImagePath + "\\" + row.Cells["Image_Id"].Value + ".Bmp");
}
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900