I have the following error when I try to save a form with linkingsetrelation field:
Invalid cast exception while trying to set the value of ProductId field on ProductRow as object.
What can cause this error? any idea?
Thx
found it.... fields must be Int32, cannot use Int64!
Related
I'm trying the following:
Event.where('ST_Contains(?,ST_SetSRID(location, 4326)::geography)', search_polygon::geography)
add getting the error
*** NoMethodError Exception: undefined method `geography' for
but without that (::geography) I get a message telling me to cast, what do I do?
HINT: No function matches the given name and argument types. You
might need to add explicit type casts.
It looks like you are trying to use ST_Contains on geography types, but that function only works on geometry types.
If you are OK with the intersects spatial relation (see DE-9IM), then use ST_Intersects(geography, geography).
I am getting the an error while executing the code below
jmsMsg.setStringProperty("MessageHeader.ServiceName","MyService");
The error is
java.lang.IllegalArgumentException: The property name 'MessageHeader.ServiceName' is not a valid java identifier.
But as per this post! my property name is a valid one.
What is going wrong here?
I don't think it likes the . (dot) character in the name. Can you can that to something like underscore and see if that works? I get a false when running Character.isJavaIdentifierPart('c').
I have been rewriting some of my old VBscript code to VB code.I am almost done with everything but I get an error at one place.
VB Script
Session("FirstName") = Request.Cookies("FirstName").Item
VB
Session.Add("FirstName", Request.Cookies("FirstName").Item)
and the error is
BC30455: Argument not specified for parameter 'key' of 'Public Default Property Item(key As String) As String'.
Can anybody tell me how to correct this error or atleast what does the error mean?
Thanks in advance.
Session.Add("FirstName", Request.Cookies("FirstName"))
should work , when you use .Item it is expecting a key for Item such as:
Session.Add("FirstName", Request.Cookies("FirstName").Item("ItemKey"))
Using the code below, I am returning an nvarchar field from MS SQL 2005 and keep getting a System.InvalidCastException.
vo.PlacementID = dr.IsDBNull(0) ? null : dr.GetString(0);
The vo.PlacementID variable is of type String so there shouldn't be a problem.
The values I am trying to return are like this (number, number, letter): 00F, 02A, 01F, etc
System.InvalidCastException: Unable to cast object of type 'System.Int32' to
type 'System.String'.
at System.Data.SqlClient.SqlBuffer.get_String()
at System.Data.SqlClient.SqlDataReader.GetString(Int32 i)
Any help much appreciated.
If you read the exception again it gives you a clue as to the problem:
System.InvalidCastException:
Unable to cast object of type 'System.Int32' to type
'System.String'. at
System.Data.SqlClient.SqlBuffer.get_String()
at
System.Data.SqlClient.SqlDataReader.GetString(Int32
i)
Basically the underlying data type being returned in column 0 of your SqlDataReader isn't a string compatible type, hence the cast exception.
I'd suggest setting a breakpoint on the offending line and then execute the following line in the immediate window:
? dr.GetValue(0).GetType()
This will tell what type being returned.
the cast exception is not raised in the assignment, but in the datareader's GetString().
try dr.GetValue(0).ToString()
The InvalidCastException isn't raised because of the type incompatibility between the PlacementID property and string. If that was the case, you'd get a compile-time error. The problem is the first field in the result set is not a string, it's something else.
This error message had me stumped for a while:
invalid conversion from 'objc_object* to 'int'
The line in question was something like this:
int iResult = [MyUtils utilsMemberFunc:param1,param2];
It doesn't matter what the "to" type is, what is important is that you recognize that this message, in this context, is reporting that the utilsMemberFunc declaration was not found and due to Objective-C's dynamic binding it is assuming it returns an objc_object* rather than the type that utilsMemberFunc was declared to return.
So why isn't it finding the declaration? Because ',' is being used rather than ':' to separate the parameters.