Insert string into a mysql TEXT column (BLOB) (VB.NET)

Discussion in 'Databases' started by Swood, Jun 11, 2005.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. Does any one know how to insert Text into a mysql TEXT column (BLOB) ? . .
    I am using the .net Connector (mysql.data.dll)


    I tried using a byte array and also a stream with no Luck . . .

    My Byte array attempt looked something like this




    Public Shared Function StrToByteArray(ByVal str As String) As Byte()


    Dim encoding As New System.Text.ASCIIEncoding


    Return encoding.GetBytes(str)


    End Function 'StrToByteArray








    My Stream attempt looked something like


    Function ConvertToStream(ByVal txt As String) As ADODB.Stream


    Dim stm As ADODB.Stream


    stm = New ADODB.Stream


    Dim oFile As System.IO.File


    Dim oWrite As System.IO.StreamWriter


    oWrite = oFile.CreateText(Application.StartupPath & "\temp.text")


    oWrite.WriteLine(txt)


    oWrite.Close()


    With stm


    stm.Type = ADODB.StreamTypeEnum.adTypeText


    .Charset = "ascii"


    .Open()


    .LoadFromFile(Application.StartupPath & "\temp.text")


    .Position = 0


    ' txtComments.Text = .ReadText


    End With


    Return stm


    End Function
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page