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();
}
nico cedrick adrianoPosted Nov 12, 2014, 9:30 PM
VulpesPosted Oct 21, 2014, 12:47 PM
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.
IsraelPosted Oct 21, 2014, 12:07 PM
IsraelPosted Oct 20, 2014, 2:19 PM
VulpesPosted Oct 20, 2014, 1:57 PM
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 :-/
IsraelPosted Oct 20, 2014, 1:40 PM
Non-negative number required.
VulpesPosted Oct 20, 2014, 1:21 PM
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:
IsraelPosted Oct 20, 2014, 12:25 PM
VulpesPosted Oct 20, 2014, 12:06 PM
IsraelPosted Oct 20, 2014, 11:51 AM
Its runs but when I make my search. Its showing a bug message: parameter not valid
The entire codes:
VulpesPosted Oct 19, 2014, 5:02 AM
IsraelPosted Oct 18, 2014, 10:02 AM