ERROR [42000] [Sybase][ODBC Driver][Adaptive Server Enterprise]Implicit conversion

  • Thread starter Thread starter VA_er
  • Start date Start date
V

VA_er

Guest
ERROR [42000] [Sybase][ODBC Driver][Adaptive Server Enterprise]Implicit conversion from datatype 'VARCHAR' to 'SMALLINT' is not allowed. Use the CONVERT function to run this query.

See below code: Field1 is smallint, Field3 is varchar(255), there is nothing more, why so many error 42000? However, there are some other fields in the table:

  • Field1: smallint
  • Field2: varchar(255)
  • Field3: varchar(255)
  • Field4: char(2)
  • Field5: smallint
  • Field6: tinyint
  • Field7: smallint




Thanks.


1416793.jpg

OdbcConnection Cn = new OdbcConnection("ConnectionString");
Cn.Open();
string Query = "SELECT 'Field1(' + Field1 + ') : ' + Field3 As ComboBoxDisplayItem FROM TableName";
OdbcCommand cmd = new OdbcCommand(Query, Cn);
OdbcDataReader dr = cmd.ExecuteReader();

Continue reading...
 
Back
Top