Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 6th, 2007, 03:58 AM
Friend of Wrox
 
Join Date: Mar 2006
Location: , , Portugal.
Posts: 310
Thanks: 0
Thanked 0 Times in 0 Posts
Default help me convert sql.image into string

Hello!
I have this problem from to much time!

I need to generate an sql insert file, in order to upload my db data.

I have this code:

Code:
Private Shared Function setParamterTypeAndValue(ByVal table As String, ByVal dr As SqlDataReader, ByVal col As Integer, ByVal sqlProviderType As String, ByVal colName As String) As String
            Dim result As String = ""
            If (sqlProviderType.ToString = "Int") Or _
            (sqlProviderType.ToString = "SmallInt") Then
                If (dr(col) Is DBNull.Value) Then
                    result += "NULL, "
                Else
                    result += CType(dr(col), String) & ", "
                End If
            ElseIf (sqlProviderType.ToString = "TinyInt") Then
                If (dr(col) Is DBNull.Value) Then
                    result += "NULL, "
                Else
                    result += CType(dr(col), Byte).ToString
                End If
            ElseIf (sqlProviderType.ToString = "VarChar") Or _
                    (sqlProviderType.ToString = "NVarChar") Or _
                    (sqlProviderType.ToString = "NChar") Or _
                    (sqlProviderType.ToString = "Char") Or _
                    (sqlProviderType.ToString = "NText") Or _
                    (sqlProviderType.ToString = "Text") Then
                If (dr(col) Is DBNull.Value) Then
                    result += "NULL, "
                Else
                    result += "'" & Replace(CType(dr(col), String), "'", "#180;") & "', "
                End If
            ElseIf (sqlProviderType.ToString = "Image") Then
                If (dr(col) Is DBNull.Value) Then
                    result += "NULL, "
                Else
                    Dim b As Byte() = CType(dr(col), Byte())
                    Dim str As String = Convert.ToString(b)
                    result += str & ", "
                End If
              ...
My big problem is when sqlprovidertype is Image/Binary!
Like the field "PropertyValuesBinary" from "aspnet_Profile" table!
With this code I return something like "...xxxx' , System.Byte[], 'blabla..."

If anyone could help me I'll be very grateful
Max

 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert Text(Sql Server Text Field) to Image(JPG) srinivas72 ADO.NET 2 February 13th, 2009 06:31 PM
convert to string prafullaborade XML 7 May 29th, 2008 02:59 PM
Convert string to Date rprasad012 ASP.NET 1.0 and 1.1 Basics 1 March 19th, 2008 07:07 AM
Convert from Image to Text niallhannon SQL Server 2000 9 February 24th, 2007 02:17 PM
Convert String Date to Date for a SQL Query tdaustin Classic ASP Basics 4 July 7th, 2003 06:01 PM



All times are GMT -4. The time now is 08:15 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.