C
chris
hi i have found some vb.net code to display a blob image on the browser.
Dim con As New SqlConnection("Server=server1;uid=sa;pwd=guest;database=db1")
Dim da As New SqlDataAdapter("Select * From table1", con)
Dim MyCB As SqlCommandBuilder = New SqlCommandBuilder(da)
Dim ds As New DataSet
con.Open()
da.Fill(ds, "table1")
Dim myRow As DataRow
myRow = ds.Tables("table1").Rows(0)
Dim MyData() As Byte
MyData = myRow("logo")
Response.Buffer = True
Response.ContentType = "Image/JPEG"
Response.BinaryWrite(MyData)
this is the vb code that works fine. but i am writing a c# app and i need to
convert the above small piece of code to c#
byte[] Picture;
Picture = (dr["logo"]); //ERROR cannot convert from object to byte
Response.Buffer=true;
Response.ContentType = "Image/JPEG";
Response.BinaryWrite(Picture);
i dont understand what i am doing wrong?
thanx
Dim con As New SqlConnection("Server=server1;uid=sa;pwd=guest;database=db1")
Dim da As New SqlDataAdapter("Select * From table1", con)
Dim MyCB As SqlCommandBuilder = New SqlCommandBuilder(da)
Dim ds As New DataSet
con.Open()
da.Fill(ds, "table1")
Dim myRow As DataRow
myRow = ds.Tables("table1").Rows(0)
Dim MyData() As Byte
MyData = myRow("logo")
Response.Buffer = True
Response.ContentType = "Image/JPEG"
Response.BinaryWrite(MyData)
this is the vb code that works fine. but i am writing a c# app and i need to
convert the above small piece of code to c#
byte[] Picture;
Picture = (dr["logo"]); //ERROR cannot convert from object to byte
Response.Buffer=true;
Response.ContentType = "Image/JPEG";
Response.BinaryWrite(Picture);
i dont understand what i am doing wrong?
thanx