title: Issue to insert record with datetime to SQL Server 2014 via ODBC C++
body: <p>I have a simple c++ code to insert a record in SQL Server 2014 via ODBC. It works fine with varchar fields, but it does not work with datetime field. </p>
  
  <pre><code>SQLCHAR buf[64];
  SQLLEN len;
  SQLCHAR buf2[255];
  SQLLEN len2;
  SQLLEN len3;
  double f;
  rc = SQLBindParameter(hstmt, 1, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_TYPE_TIMESTAMP, 19, 0, (SQLCHAR*)buf, 0, &amp;len);
  rc = SQLBindParameter(hstmt, 2, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_VARCHAR, 255, 0, (SQLCHAR*)buf2, 0, &amp;len2);
  rc = SQLBindParameter(hstmt, 3, SQL_PARAM_INPUT, SQL_C_FLOAT, SQL_FLOAT, 15, 0, &amp;f, 0, &amp;len3);
  rc = SQLPrepare(hstmt, (SQLCHAR*)"insert into test(timepoint,strvalue,floatvalue) values (?,?,?)", SQL_NTS);
  
  strcpy((char*)buf,"20171010 00:08:14");
  len=strlen("20171017 00:08:14");
  strcpy((char*)buf2,"simple string");
  len2=strlen("simple string");
  f=1.34e+8;
  
  SQLSMALLINT NumParams;
  SQLNumParams(hstmt, &amp;NumParams);
  rc = SQLExecute(hstmt);
  </code></pre>
  
  <p>Can anybody help to understand that is wrong?
  I've got always:</p>
  
  <p>"22018:1:0:[Microsoft][ODBC SQL Server Driver]Invalid character value for cast specification\n"</p>
  
  <p>If I'm wrong here with my question, please give a hint which forum fits better. I've spent some days, but can't find the solution. For any help would be very appreciate.</p>