Image in Database [modified]
-
hello world! I wanted to access my Images In Database and I write these codes :
byte[] buffer2 = (byte[])dsPicture.Tables["documentImageTable"].Rows[3]["diImage"];
MemoryStream stream2 = new MemoryStream(buffer2);
pictureBox2.Image = Image.FromStream(stream2);
stream2.Close();But It have this error: Object reference not set to an instance of an object. Tanx world...
modified on Monday, October 20, 2008 1:40 PM
-
hello world! I wanted to access my Images In Database and I write these codes :
byte[] buffer2 = (byte[])dsPicture.Tables["documentImageTable"].Rows[3]["diImage"];
MemoryStream stream2 = new MemoryStream(buffer2);
pictureBox2.Image = Image.FromStream(stream2);
stream2.Close();But It have this error: Object reference not set to an instance of an object. Tanx world...
modified on Monday, October 20, 2008 1:40 PM
-
You should turn option strict on in your project, so that you get an error message telling you that you are using the variable stream1 that is not declared anywhere.
Despite everything, the person most likely to be fooling you next is yourself.
Guffa wrote:
option strict
:rolleyes:
Eslam Afifi
-
You should turn option strict on in your project, so that you get an error message telling you that you are using the variable stream1 that is not declared anywhere.
Despite everything, the person most likely to be fooling you next is yourself.
My problem not solve ... :(
if(Human.live) { Human.peaceful = false; while(true) { Human.love(Human girl, Human Boy); } }
-
My problem not solve ... :(
if(Human.live) { Human.peaceful = false; while(true) { Human.love(Human girl, Human Boy); } }
What do you mean? You open stream2 and close stream1 (which doesn't exist in the code that you posted), that is definitely a problem. It might not be your only problem, though. On which line do you get the error message? Edit: You should name your variables to something more descriptive than stream1 and stream2, that way you are not so likely to mix them up.
Despite everything, the person most likely to be fooling you next is yourself.
-
You should turn option strict on in your project, so that you get an error message telling you that you are using the variable stream1 that is not declared anywhere.
Despite everything, the person most likely to be fooling you next is yourself.
Guffa wrote:
option strict on
Is there even one in C#?
"The clue train passed his station without stopping." - John Simmons / outlaw programmer "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon "Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
-
Guffa wrote:
option strict on
Is there even one in C#?
"The clue train passed his station without stopping." - John Simmons / outlaw programmer "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon "Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
-
You should turn option strict on in your project, so that you get an error message telling you that you are using the variable stream1 that is not declared anywhere.
Despite everything, the person most likely to be fooling you next is yourself.
I writed correctly in my codes but I wrong in this... what I do for solve this error ...
if(Human.live) { Human.peaceful = false; while(true) { Human.love(Human girl, Human Boy); } }
-
You should turn option strict on in your project, so that you get an error message telling you that you are using the variable stream1 that is not declared anywhere.
Despite everything, the person most likely to be fooling you next is yourself.
Use this routine (doesn´t crash with *.gifs) :omg:
// read image
public static byte[] ReadFile(string image_path)
{
byte[] data = null;FileInfo file_info = new FileInfo(image_path);
long bytes_count = file_info.Length;FileStream file_stream = new FileStream(image_path, FileMode.Open, FileAccess.Read);
BinaryReader br = new BinaryReader(file_stream);
data = br.ReadBytes((int)bytes_count);
return data;
}nelsonpaixao@yahoo.com.br trying to help & get help
-
Use this routine (doesn´t crash with *.gifs) :omg:
// read image
public static byte[] ReadFile(string image_path)
{
byte[] data = null;FileInfo file_info = new FileInfo(image_path);
long bytes_count = file_info.Length;FileStream file_stream = new FileStream(image_path, FileMode.Open, FileAccess.Read);
BinaryReader br = new BinaryReader(file_stream);
data = br.ReadBytes((int)bytes_count);
return data;
}nelsonpaixao@yahoo.com.br trying to help & get help
Mr nelsonpaixao, my Image in database And not in file ...
if(Human.live)
{
Human.peaceful = false;
while(true)
{
Human.love(Human girl, Human Boy);
}
}