King, I recall seeing that the image in the NWDB had some extra header stuff
on it that you needed to skip over. I can't find that doc for you. But I can
give you some C# code that will write an image and read one. I'm sure you can
then get your vb to run.
Holler back with more questions or you figure out what the byte offset is
for northwind so I can write it down this time...Chuck
The code is driving a sql db, the image table has a id and an image column.
Here is the save the images into the db:
this.sqlInsertCommand1.Parameters["@testId"].Value =
int.Parse(this.txttestId.Text);
// save the data to a stream
MemoryStream ms = new MemoryStream();
this.pBox1.Image.Save(ms,ImageFormat.Jpeg);
// now save the stream as a byte array
byte[] imageBytes = new byte[ms.Length];
ms.Seek(0,SeekOrigin.Begin); // must rewind from the write
ms.Read(imageBytes,0,(int)ms.Length);
this.sqlInsertCommand1.Parameters["@testPic"].Value = imageBytes;
this.sqlInsertCommand1.ExecuteNonQuery();
And here is the read code:
SqlCommand sc = new SqlCommand("Select testPic from imageTest where
testId=@testId;",this.sqlConnection1);
sc.Parameters.Add(new SqlParameter("@testId",SqlDbType.Int));
sc.Parameters["@testId"].Value = int.Parse(this.txttestId.Text);
byte[] dbData = (byte[])sc.ExecuteScalar();
MemoryStream ms = new MemoryStream();
ms.Write(dbData,0,dbData.Length);
Bitmap bm = new Bitmap(ms);
this.pBox1.Image = bm;