See Also

MySqlBinaryString Members  | Devart.Data.MySql Namespace  | Value Property  | Encoding Property  | Buffer Property

 

Language

Visual Basic

C#

Show All

See AlsoRequirementsLanguagesDevart.Data.MySqlSend comments on this topic.

MySqlBinaryString Structure

Represents MySQL BINARY and VARBINARY types.

For a list of all members of this type, see MySqlBinaryString members.

Inheritance Hierarchy

System.Object
   System.ValueType
      Devart.Data.MySql.MySqlBinaryString

Syntax

[Visual Basic]
Public Structure MySqlBinaryString    Inherits ValueType    Implements INullableIComparable 
[C#]
public struct MySqlBinaryString : ValueType, INullableIComparable 

Remarks

This structure manages BINARY and VARBINARY as strings with certain encoding (specified with the Encoding property).

Example

The following example demonstrates how to insert and fetch text data using binary types.

[C#] 

MySqlCommand insertCommand = new MySqlCommand("insert into autotest.simple_types (f_binary, f_varbinary) values (:p1, :p2)", connection); 
 
Encoding encoding = Encoding.Unicode; 
byte[] buffer1 = encoding.GetBytes("test1"); 
byte[] buffer2 = encoding.GetBytes("test2"); 
 
insertCommand.Parameters.Add("p1", new MySqlBinaryString(buffer1, encoding)); 
insertCommand.Parameters.Add("p2", new MySqlBinaryString(buffer2, encoding)); 
insertCommand.ExecuteNonQuery(); 
 
MySqlCommand selectCommand = new MySqlCommand("select f_binary, f_varbinary from autotest.simple_types", connection); 
 
using (MySqlDataReader reader = selectCommand.ExecuteReader()) 
 while (reader.Read()) 
   for (int i = 0; i < reader.FieldCount; ++i) { 
     MySqlBinaryString value = (MySqlBinaryString)reader.GetProviderSpecificValue(i); 
     value.Encoding = encoding; 
     Console.WriteLine(value); 
   }

 

See Also

MySqlBinaryString Members  | Devart.Data.MySql Namespace  | Value Property  | Encoding Property  | Buffer Property

 

 


© 2002 - 2008 Devart. All Rights Reserved.