9. Understanding .NET Data Provider Connectivity : Data Types Mapping : Coercion of Unicode Strings
 
Share this page                  
Coercion of Unicode Strings
.NET strings are Unicode based. If the application is sending a Unicode string as a parameter to a database field that is ASCII char or varchar, the application can direct the data provider to coerce the Unicode string to an ASCII string on the client side by setting the IngresParameter's DbType property to DbType.AnsiString or the IngresType property to IngresType.VarChar.
The following is an example of coercing a Unicode string:
IngresCommand cmd = new IngresCommand(
    "select name from personnel where ssn = ?",
    conn);

IngresParameter parm =
    new IngresParameter("SSN", IngresType.VarChar);
parm.Value = strSSN;
cmd.Parameters.Add(parm);