我们正在Windows CE 5.0设备上部署SQLAnywhere解决方案,并在第一个SQL语句中遇到错误。
定义是......
Dim dbf As String = "dbf=\Program Files\sfpwarehousescanner\BRAINY2_remote.udb"
Public conn As ULConnection = New iAnywhere.Data.UltraLite.ULConnection(dbf)
Public cmdDel As ULCommand
Public cmdSel As ULCommand
Public cmdUpd As ULCommand
违规代码......
Public Sub GetDefaults()
Dim SQL As String = ""
Try
SQL = "SELECT ISNULL(Dot, 'T'), ISNULL(Distance, 'L'), ISNULL(Force_Change, 'Y') " _
& "FROM cims.scan_settings " _
& "WHERE username = '" + UName.ToString + "'"
cmdSel = conn.CreateCommand()
cmdSel.CommandText = SQL
Dim ULReader As ULDataReader
ULReader = cmdSel.ExecuteReader
我们收到的错误是......
Error (level = 7) in General.GetDefaults:
IDS_AMP_INVALID_OPER_ON_EXECUTE_CMD -
SELECT ISNULL(Dot, 'T'), ISNULL(Distance, 'L'), ISNULL(Force_Change, 'Y')
FROM cims.scan_settings WHERE username = 'test'
非常感谢任何帮助!
我现在已经将sql简化为'SELECT * FROM scan_settings',我仍然遇到同样的问题。
答案 0 :(得分:2)
我没有在应用中包含ulnet12.dll和ulnetclient12.dll。现在跑得很好。
答案 1 :(得分:0)
错误消息似乎表明数据库无法进行某些比较。对于ISNULL,所有表达式必须具有可比性(http://dcx.sybase.com/index.html#1201/en/dbreference/isnull-function.html)。如果Dot,Distance和Force_Change数据类型与CHAR不可比,则可能是问题。