我有一个Informix存储过程,它接受一个int和一个“smallint”作为参数。我试图从.net4 Visual Basic程序调用此SP。将Byte传递为SmallInt?
据我所知,“smallint”是一个字节。不幸的是,装载了IfxCommand.Parameters收集与一个整数和一个字节的时候,我得到了下面的堆栈跟踪抛出的{"The parameter data type of Byte is invalid."}
一个ArgumentException:
在IBM.Data.Informix.TypeMap.FromObjectType(类型数据类型Int32长度) at IBM.Data.Informix.TypeMap.FromObjectType(Type dataType) at IBM.Data.Informix.IfxParameter.GetTypeMap() at IBM.Data.Informix.IfxParameter.GetOutputValue(IntPtr stmt,CNativeBuffer valueBuffer,CNativeBuffer lenIndBuffer) at IBM.Data.Informix.IfxDataReader.Dispose(Boolean disposing) at IBM.Data.Informix.IfxDataReader.System.IDisposable.Dispose() at IBM.D ata.Informix.IfxCommand.ExecuteReaderObject(的CommandBehavior行为,字符串方法) 在IBM.Data.Informix.IfxCommand.ExecuteReader(的CommandBehavior行为) 在IBM.Data.Informix.IfxCommand.ExecuteReader()
推测我不知何故,我需要将Byte投给一个smallint,但目前Google并没有给我任何相关的答案。
我已经尝试使用:
cmd.Parameters.Add(New IfxParameter("myVal", IBM.Data.Informix.IfxType.SmallInt)).Value = myByte
,但在执行时,读者我仍然得到同样的ArgumentException。
有人能告诉我我做错了什么吗?
'Byte'有点像UInt8,没有标志,你试过'short'还是'Int16'? – Jodrell 2011-05-16 15:53:09
那么,显然我公司的每个人都认为Informix smallint是一个字节是错误的。我没有真正考虑过这种可能性...... – Frosty840 2011-05-16 17:25:19
回复:我之前的评论,请不要将我的假想的UInt8与informix Int8混淆,这实际上更像是一个。Net Long或Int64,如果他们是正确的,请不要忘记标记或提出答案。 – Jodrell 2011-05-17 08:24:11