title: "ERROR [22018] [IBM][System i Access ODBC Driver]Error in assignment" in parameterized ODBC query for sql type CHAR
body: <p><strong>Following is the code using parameterized query to query a DB2-i (DB2 for iSeries) database.</strong></p>
  
  <pre><code>OdbcConnection conn = new OdbcConnection(connStrSb.ToString());
  conn.Open();
  var cmd = conn.CreateCommand();
  cmd.CommandText= "SELECT * FROM table1 WHERE col1 &gt;= ?";
  cmd.Parameters.AddWithValue("ss", "View_Status_Code");
  var x = cmd.ExecuteReader();
  x.Read();
  </code></pre>
  
  <p>Here <strong>col1 is CHAR FOR BIT DATA</strong></p>
  
  <p>The above code throws the following exception:</p>
  
  <pre><code>ERROR [22018] [IBM][System i Access ODBC Driver]Error in assignment.
  </code></pre>
  
  <p><strong>Following is the code using normal query (without parameters):</strong></p>
  
  <pre><code>OdbcConnection conn = new OdbcConnection(connStrSb.ToString());
  conn.Open();
  var cmd = conn.CreateCommand();
  cmd.CommandText = "SELECT * FROM table1 WHERE col1 &gt;= 'View_Status_Code'";
  var x = cmd.ExecuteReader();
  x.Read();
  </code></pre>
  
  <p>The above code works fine and returns a resultset.</p>