dotConnect for MySQL Documentation
Devart.Data.MySql Namespace / MySqlDataReader Class / GetMySqlText Method / GetMySqlText(String) Method
The name of the column to get value of.
Example

GetMySqlText(String) Method
Gets the value of the specified column as a MySqlText object.
Syntax
'Declaration
 
Public Overloads Function GetMySqlText( _
   ByVal name As String _
) As MySqlText
 

Parameters

name
The name of the column to get value of.

Return Value

The value of the specified column as a MySqlText object.
Example
This example shows how to download a TEXT field from a table using GetMySqlBlob method.
public void DownloadSqlText(MySqlConnection myConnection)
{
  myConnection.Unicode = true;
  MySqlCommand myCommand = new MySqlCommand("SELECT * FROM Test.TextBlocks", myConnection);
  myConnection.Open();
  MySqlDataReader myReader = myCommand.ExecuteReader(CommandBehavior.Default);
  try
  {
    while (myReader.Read())
    {
      MySqlText myTextSql = myReader.GetMySqlText(myReader.GetOrdinal("BlockContent"));
      if(!myTextSql.IsNull)
      {
        Console.WriteLine(myTextSql.Value);
      }
    }
  }
  finally
  {
    myReader.Close();
    myConnection.Close();
  }
}
Public Sub UploadSqlText(ByVal myConnection As MySqlConnection)
  myConnection.Unicode = True
  Dim myTextSql As MySqlText = New MySqlText("This is a test text block")
  Dim myCommand As MySqlCommand = New MySqlCommand("INSERT INTO Test.TextBlocks (BlockID, BlockName, BlockContent) VALUES(3,'First',:BlockText)", myConnection)
  myCommand.Parameters.Add("BlockText", myTextSql)
  myConnection.Open()
  Try
    Console.WriteLine(String.Concat(myCommand.ExecuteNonQuery(), " rows affected."))
  Finally
    myConnection.Close()
  End Try
End Sub

Public Sub DownloadSqlText(ByVal myConnection As MySqlConnection)
  myConnection.Unicode = True
  Dim myCommand As New MySqlCommand("SELECT * FROM Test.TextBlocks", myConnection)
  myConnection.Open()
  Dim myReader As MySqlDataReader = myCommand.ExecuteReader(CommandBehavior.Default)
  Try
    While myReader.Read()
      Dim myTextSql As MySqlText = myReader.GetMySqlText(myReader.GetOrdinal("BlockContent"))
      If Not myTextSql.IsNull Then
        Console.WriteLine(myTextSql.Value)
      End If
    End While
  Finally
    myReader.Close()
    myConnection.Close()
  End Try
End Sub
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also