Current filter:
                                You should refresh the page.
                                0
                                  • Hi all,

                                    I have a problem with view-s in XPO. When I call GetObjectsFromSproc from helper method and if my XPOObject definition contains double type I get error "Specify cast is not valid"

                                    1. Restore attached db
                                    2. Run the project

                                    If I change type for property TestError ( in vwsp_Test class ) from Double to Integer everything is working ok?!

                                    Could you confirm that this is a bug?

                                    Regards,
                                    Neven

                                DEVEX-TEST.zip
                                0

                                Hi Neven,

                                I do not see any issue in this behavior. Your stored procedures returns an integer constant in this column. When XPO retrieves data from your stored procedure the result set produced by the SqlDataReader contains an integer column. So, it throws an exception when tries to cast an integer value to the Double type specified in your code.

                                To return a Double value from a stored procedure, modify its select statement as follows:

                                	
                                [SQL]
                                ALTER PROCEDURE [dbo].[vwsp_Test] @DatumOd datetime, @DatumDo datetime AS BEGIN SET NOCOUNT ON; SELECT *, TestError=CONVERT(float, 1) FROM dbo.vw_TestDb WHERE (OrderDate BETWEEN @DatumOd and @DatumDo) END

                                Thanks,
                                Michael.

                                You must  log in  or  register  to leave an answer

                                Is your intention to post an answer to your own question?

                                • If so, then proceed.
                                • If you simply wanted to post additional information, ask for further clarification, or to just say "Thanks!", please click Leave a Comment.
                                • If you wish to edit your original question, please use the Edit button in the Toolbox at the top right corner of that entry.