Click here to Skip to main content
15,885,880 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionAJAX and FileUpload Pin
steve_a_p30-Aug-07 23:18
steve_a_p30-Aug-07 23:18 
AnswerRe: AJAX and FileUpload Pin
qtuan30-Aug-07 23:44
qtuan30-Aug-07 23:44 
GeneralRe: AJAX and FileUpload Pin
steve_a_p31-Aug-07 2:17
steve_a_p31-Aug-07 2:17 
GeneralRe: AJAX and FileUpload Pin
Vasudevan Deepak Kumar2-Sep-07 1:02
Vasudevan Deepak Kumar2-Sep-07 1:02 
QuestionRe: AJAX and FileUpload Pin
steve_a_p2-Sep-07 23:22
steve_a_p2-Sep-07 23:22 
Questionhow we navigatetourl with buttonfield column in gridview Pin
puspendra napit30-Aug-07 23:16
puspendra napit30-Aug-07 23:16 
AnswerRe: how we navigatetourl with buttonfield column in gridview Pin
VenkataRamana.Gali31-Aug-07 1:22
VenkataRamana.Gali31-Aug-07 1:22 
QuestionError: Value of type 'Byte' cannot be converted to '1-dimensional array of Byte' Pin
Milind Panchal30-Aug-07 22:42
Milind Panchal30-Aug-07 22:42 
Hi,

I am Retrieving the binary image from sql database on web page. For that I have written following code in vb.net


Dim stream As MemoryStream = New MemoryStream()

Dim image As Byte()
Dim bitmap As Bitmap
Dim username As String
username = Session("memberuser")
con = New SqlConnection("server=ABC-0A55D6C3C90;database=satphere;uid=sa;pwd=")
Try
con.Open()
cmd = New SqlCommand("select photo from ViewProfile where userid = @userid", con)
cmd.Parameters.AddWithValue("@userid", username)
>>>>>>>>> image = CByte(cmd.ExecuteScalar())
stream.Write(image, 0, image.Length)
bitmap = New Bitmap(stream)
Response.ContentType = "image/gif"
'bitmap.Save(Response.OutputStream, ImageFormat.Gif)
bitmap.Save(Server.MapPath("TempImage/aa.gif"))
Image1.ImageUrl = "TempImage/aa.gif"
Catch ex As Exception
con.Close()
Stream.Close()
End Try

I am getting the error as
Value of type 'Byte' cannot be converted to '1-dimensional array of Byte'

line is mentioned by >>>>>>


C#.net code for same is working fine--------------as follwos

MemoryStream stream = new MemoryStream ();
SqlConnection connection = new SqlConnection(@"server=ABC-0A55D6C3C90;database=Test;uid=sa;pwd=");
try
{
connection.Open ();
SqlCommand command = new SqlCommand("select Picture from Image", connection);




byte[] image = (byte[])command.ExecuteScalar();
stream.Write(image, 0, image.Length);

Bitmap bitmap = new Bitmap(stream);

Response.ContentType = "image/gif";

bitmap.Save(Response.OutputStream, ImageFormat.Gif);
//bitmap.Save(Server.MapPath("TempImage/aa.gif"));


}
finally
{
connection.Close ();
stream.Close ();
}

can any one give me solution for this

Thanks to all
AnswerRe: Error: Value of type 'Byte' cannot be converted to '1-dimensional array of Byte' Pin
Imran Khan Pathan30-Aug-07 23:15
Imran Khan Pathan30-Aug-07 23:15 
AnswerRe: Error: Value of type 'Byte' cannot be converted to '1-dimensional array of Byte' Pin
l0kke30-Aug-07 23:21
l0kke30-Aug-07 23:21 
QuestionHow to get IpAddress of the system. Pin
rahul.net1130-Aug-07 22:22
rahul.net1130-Aug-07 22:22 
AnswerRe: How to get IpAddress of the system. Pin
Imran Khan Pathan30-Aug-07 23:17
Imran Khan Pathan30-Aug-07 23:17 
GeneralRe: How to get IpAddress of the system. Pin
rahul.net1130-Aug-07 23:26
rahul.net1130-Aug-07 23:26 
AnswerRe: How to get IpAddress of the system. Pin
Vasudevan Deepak Kumar31-Aug-07 7:31
Vasudevan Deepak Kumar31-Aug-07 7:31 
AnswerRe: Give me a solution Pin
Michael Sync30-Aug-07 22:04
Michael Sync30-Aug-07 22:04 
QuestionHow can I input data into a dropdownlist ? Pin
Big Ralph30-Aug-07 21:46
Big Ralph30-Aug-07 21:46 
AnswerRe: How can I input data into a dropdownlist ? Pin
\laddie30-Aug-07 21:56
\laddie30-Aug-07 21:56 
GeneralRe: How can I input data into a dropdownlist ? Pin
Big Ralph30-Aug-07 22:00
Big Ralph30-Aug-07 22:00 
Questionhow to enable javascript at runtime in asp.net Pin
puspendra napit30-Aug-07 21:37
puspendra napit30-Aug-07 21:37 
AnswerRe: how to enable javascript at runtime in asp.net Pin
\laddie30-Aug-07 21:46
\laddie30-Aug-07 21:46 
AnswerRe: how to enable javascript at runtime in asp.net Pin
Michael Sync30-Aug-07 22:01
Michael Sync30-Aug-07 22:01 
QuestionRe: how to enable javascript at runtime in asp.net Pin
Satish_S31-Aug-07 19:35
Satish_S31-Aug-07 19:35 
AnswerRe: how to enable javascript at runtime in asp.net Pin
Michael Sync31-Aug-07 20:51
Michael Sync31-Aug-07 20:51 
AnswerRe: how to enable javascript at runtime in asp.net Pin
Vasudevan Deepak Kumar30-Aug-07 22:09
Vasudevan Deepak Kumar30-Aug-07 22:09 
QuestionDrag and drop rows in grid view or repater Pin
ysunil_7430-Aug-07 21:37
ysunil_7430-Aug-07 21:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.