Error querying/updating 'tinyint' fields in SQL Server Compact
Posted: Wed 19 Mar 2014 22:15
I just found what I'm guessing is yet another conflict resulting from trying to query or update a specific field type (tinyint) using parameterized SQL.
The following code is sufficient to cause an issue:
I get the same exception error message I've seen previously in similar situations:
Note that I only see this error with SQL Server Compact, not in SQL Server.
My development environment consists of:
• Windows 7 (64-bit)
• RAD Studio 2010
• MS SQL Server Compact 3.5
• MS SQL Server Express 2008 R2
• SDAC 6.9.17
Here are some of earlier posts where I reported similar issues:
• http://forums.devart.com/viewtopic.php?f=6&t=24873
• http://forums.devart.com/viewtopic.php?f=6&t=21172
The following code is sufficient to cause an issue:
Code: Select all
Command->SQL->Text = "INSERT [TableName] ( [TinyIntField] ) VALUES ( :TinyIntValue )";
Command->Params->Items[0]->Value = 1;
Command->Execute();I've also explored other alternatives, introducing different combinations of the following code, but with the same result:Requested conversion is not supported. [,,,,,]
Code: Select all
Command->Params->Items[0]->DataType = ftByte;
Command->Params->Items[0]->AsByte = 1;
Command->Params->Items[0]->AsInteger = 1;My development environment consists of:
• Windows 7 (64-bit)
• RAD Studio 2010
• MS SQL Server Compact 3.5
• MS SQL Server Express 2008 R2
• SDAC 6.9.17
Here are some of earlier posts where I reported similar issues:
• http://forums.devart.com/viewtopic.php?f=6&t=24873
• http://forums.devart.com/viewtopic.php?f=6&t=21172