cmdInsert.Parameters.Add(new OleDbParameter("@Student_Section", OleDbType.VarWChar, 50, "Student_Section"));
                    cmdInsert.Parameters.Add(new OleDbParameter("@Birth_Month", OleDbType.VarWChar, 50, "Birth_Month"));
                    cmdInsert.Parameters.Add(new OleDbParameter("@Birth_Date", OleDbType.VarWChar, 50, "Birth_Date"));
                    cmdInsert.Parameters.Add(new OleDbParameter("@Birth_Year", OleDbType.VarWChar, 50, "Birth_Year"));
                    cmdInsert.Parameters.Add(new OleDbParameter("@Gender", OleDbType.VarWChar, 50, "Gender"));
                    cmdInsert.Parameters.Add(new OleDbParameter("@Picture", OleDbType.Binary,50, "Picture")); //<<----//I do not know the proper format of saving..
                    cmdInsert.Parameters.Add(new OleDbParameter("@Teacher", OleDbType.VarWChar, 50, "Teacher"));

Recommended Answers

All 4 Replies

If you have an image in code then you should be able to get the byte array out of the object that contains the data. It might be called GetBytes() or something. In any case, look for a method which will give you a byte array.

I also noticed that you specified a length of 50 bytes. That's not going to be enough to store a decently sized image. Try 2Mb instead. That will let you have a JPEG of decent size.

To store, you pass the byte array of the image data as the Value of that parameter.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.