Showing posts with label image. Show all posts
Showing posts with label image. Show all posts

Monday, March 12, 2012

ms sql image data from my-sql

hi people

I have imported "blob" data from mysql to an ms-sql 2000 "Image" field, using ms- sql enterprise manager. However my c# image veiwer does not work on the imported blob data (it does work on data I add to ms-sql via my web application).

Is there any way I can check that the blob data creates a valid image? If anyone has any ideas of how I can debug the data coming out that would be great. Or perhaps someone can point me to somewhere I can get some help?

any pointers are much appreciated!

Greg


There is an article on migration data from Oracle Unix to SQL you might find useful http://technet.microsoft.com/en-us/library/bb497067.aspx|||

Hi,

Here's one more idea: using ADO and simple vbscript/jscript you could save the blob to a file (using the chunk or stream model for BLOBs). Then simply open the file in an image viewer.

In addition, you could use similar approach and do byte-comparison with the data from the MySQL source.

HTH,
Jivko Dobrev - MSFT
--
This posting is provided "AS IS" with no warranties, and confers no rights.

|||

ok thanks guys, however I think my image data was simply corrupt after all of our efforts :-)

ms sql image + vb.net

Hi,

could anyone help me how to get the images from ms sql database with asp.net (visual basic)?

I have a field in the database with datatype image, and there are a couple of images in this table.

Now I am wondering how to get this images and view them on my .aspx page?

Thank you.I've have solved it.

<%@. Page Language="vb" debug="true" %>
<%@. Import Namespace="System.Data" %>
<%@. Import Namespace="System.Data.SqlClient" %>
<script runat="server">

Dim u As String

Sub Page_load
u = Request.QueryString("u")
getImage(u)
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<script runat=server
Public Sub getImage(ByVal u)

' Create Instance of Connection and Command Object

Dim myConnection As New SqlConnection("Server=localhost;uid=xx;pwd=xx;database=xx")

Dim myCommand As New SqlCommand("Select avatarImage from yaf_user where Name = @.u", myConnection)
myCommand.Parameters.AddWithValue("@.u", u)

Try

myConnection.Open()

Dim myDataReader As SqlDataReader

myDataReader = myCommand.ExecuteReader(CommandBehavior.CloseConnection)

Do While (myDataReader.Read())

'Response.ContentType = myDataReader.Item("avatar")
Response.ContentType = "image/gif"
Response.BinaryWrite(myDataReader.Item("avatarImage"))

Loop

myConnection.Close()

Response.Write("Person info successfully retrieved!")

Catch SQLexc As SqlException

Response.Write("Read Failed : " & SQLexc.ToString())

End Try

End Sub

</script>
</body>
</html