title: Error when inserting data into AS400 using C# Application
body: <p>I'm using .Net framework 4.0. and I've the the source code like this:</p>
  
  <pre><code>....
  using (MySqlCommand cmd = new MySqlCommand())
  {
     cmd.Connection = conn;
     String query = "SELECT a.process_id, a.prod_dt, a.vlt_dt, a.prod_month, a.karoseri, a.error_flag, a.created_by, date_format(a.created_dt, '%Y%m%d') as created_dt, a.updated_by, date_format(a.updated_dt, '%Y%m%d') as updated_dt FROM tb_t_vlt_web a " +
                          "WHERE a.process_id = '" + processId + "'";
                      DataTable dt = CSTDDBUtil.ExecuteQuery(query);
     if (dt.Rows.Count &gt; 0)
     { 
        as400Con = CSTDDBUtil.GetAS400Connection();
        as400Con.Open();
  
        using (OdbcCommand as400Cmd = new OdbcCommand())
        {
            as400Cmd.Connection = as400Con;
            as400Cmd.CommandText = "INSERT INTO DCDLIB.TBTVLT(VLPRID, VLPRDT, VLVLDT, VLPRMO, VLKRCD, VLERFG, VLCRBY, VLCRDT, VLCHBY, VLCHDT) VALUES " +
                              "(?,?,?,?,?,?,?,?,?,?)";
  
            foreach (DataRow dr in dt.Rows)
            {
                as400Cmd.Parameters.Add("1", OdbcType.VarChar).Value = dr["process_id"].ToString();
                as400Cmd.Parameters.Add("2", OdbcType.Numeric).Value = dr["prod_dt"];
                as400Cmd.Parameters.Add("3", OdbcType.Numeric).Value = dr["vlt_dt"];
                as400Cmd.Parameters.Add("4", OdbcType.VarChar).Value = dr["prod_month"].ToString();
                as400Cmd.Parameters.Add("5", OdbcType.VarChar).Value = dr["karoseri"].ToString();
                as400Cmd.Parameters.Add("6", OdbcType.VarChar).Value = dr["error_flag"].ToString();
                as400Cmd.Parameters.Add("7", OdbcType.VarChar).Value = dr["created_by"].ToString();
                as400Cmd.Parameters.Add("8", OdbcType.Numeric).Value = dr["created_dt"];
                as400Cmd.Parameters.Add("9", OdbcType.VarChar).Value = dr["updated_by"].ToString();
                as400Cmd.Parameters.Add("10", OdbcType.Numeric).Value = dr["updated_dt"];
  
                as400Cmd.ExecuteNonQuery();
                as400Cmd.Parameters.Clear();
           }
           as400Cmd.Dispose();
       }
  }
  ... Next Process Below ...
  </code></pre>
  
  <p>When I execute the program, there is an error occurred on <code>as400Cmd.ExecuteNonQuery();</code>. The error was:<br></p>
  
  <pre><code>ERROR [00000] [IBM][System i Access ODBC Driver]Column 4: CWB0111 - Input data is too big to fit into field
  ERROR [22001] [IBM][System i Access ODBC Driver]Column 4: Character data right truncation. 
  </code></pre>
  
  <p>And then, I've checked the AS400 and there is no problem with the column size.<br>
  How can I resolved this error..?<br><br>
  Structure table of TBTVLT
  <img src="https://i.stack.imgur.com/cq90O.png" alt="Structure Table TBTVLT"></p>