I do search on the net how to display on the picturebox. I do find solution but it's wrote with others codes. What I need I want to follow the way I wrote my codes.
Please have a look and help me to correct these codee to display my picture from database please. Thanx:
string connectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\test1\test2\\app_data\office.mdb;Persist Security Info=False";
OleDbConnection sqlCon = new OleDbConnection(connectionString);
sqlCon.Open();
string commandString = "select * from full_personal where nome ='" + txtName.Text + "'";
OleDbCommand sqlCmd = new OleDbCommand(commandString, sqlCon);
OleDbDataReader read = sqlCmd.ExecuteReader();
if (read.HasRows)
{
while (read.Read())
{
txtCod.Text = read["code"].ToString();
cbxNumberType.Text = read["number"].ToString();
picBxCadastFunc.Image = read["foto"].ToString();
}
read.Close();
sqlCon.Close();
}

IsraelRank #1,223 · 1.5K reputationPosted Oct 18, 2014, 6:02 AM EDT
VulpesRank #55 · 29.2K reputationPosted Oct 19, 2014, 1:02 AM EDT
IsraelRank #1,223 · 1.5K reputationPosted Oct 20, 2014, 7:51 AM EDT
Its runs but when I make my search. Its showing a bug message: parameter not valid
The entire codes:
VulpesRank #55 · 29.2K reputationPosted Oct 20, 2014, 8:06 AM EDT
IsraelRank #1,223 · 1.5K reputationPosted Oct 20, 2014, 8:25 AM EDT
VulpesRank #55 · 29.2K reputationPosted Oct 20, 2014, 9:21 AM EDT
So, if it's still not working, it's difficult to know what else to suggest :(
I guess we'd better check that the byte array isn't empty. Can you insert the highlighted line and tell me what you see:
IsraelRank #1,223 · 1.5K reputationPosted Oct 20, 2014, 9:40 AM EDT
Non-negative number required.
VulpesRank #55 · 29.2K reputationPosted Oct 20, 2014, 9:57 AM EDT
I take it that the image is displaying OK in Access itself?
Are you sure that this is the correct column you're reading. A byte value of 2 suggests it's an Integer column rather than an OLE object :-/
IsraelRank #1,223 · 1.5K reputationPosted Oct 20, 2014, 10:19 AM EDT
IsraelRank #1,223 · 1.5K reputationPosted Oct 21, 2014, 8:07 AM EDT
VulpesRank #55 · 29.2K reputationPosted Oct 21, 2014, 8:47 AM EDT
If only two bytes are being read, then clearly it's not an image but if you're sure that the column called 'foto' does contain an image (OLE object) and it's displaying OK in Access, then it's difficult to see why it's not working.
nico cedrick adriano3 reputationPosted Nov 12, 2014, 4:30 PM EST