StrataFrame Forum

Conversion from type 'Guid' to type 'String' is not valid.

http://forum.strataframe.net/Topic26948.aspx

By Marcel Heitlager - 4/21/2010

Hi guys,



I can't figure this one out. But this started after I updated to latest beta, I started getting this problem on my development machine. I noticed that it wasn't happening on the testing server, but then I discovered that I wasn't copying the latest staraframe dll's to the server (so it was still using the old version). The issue is as follows:



I have a table with a GUID primary key.



Then I call any of the following:



Me.UCPlansBO.Sort = "pl_NumberOfPmts DESC"





OR





Line 197: If Me.MyPlansBO.SeekToPrimaryKey(Me.MyPlanMembersBO.pm_Pl_Key) Then





It throws the following error:



Exception Details: System.InvalidCastException: Conversion from type 'Guid' to type 'String' is not valid.





The partial stack trace is as follows:



[InvalidCastException: Conversion from type 'Guid' to type 'String' is not valid.]

Microsoft.VisualBasic.CompilerServices.Conversions.ToString(Object Value) +453096

MicroFour.StrataFrame.Business.BusinessLayer.GetIndexOfPrimaryKey(Object[] PrimaryKeyValues) +233

MicroFour.StrataFrame.Business.BusinessLayer.SeekToPrimaryKey(Object[] PrimaryKeyValues) +15

AESWebAccess.EnrollmentWizard.SubmitPlanInfo() in E:\_VS2008Projects\DEV\AES\New_AESWebAccess\AESWebAccess\MyAccount\Applications\EnrollmentWizard.PlanDetail.vb:197







I reverted to the previous build and it worked again. Am I doing something screwy though, or is it a bug (or both?Tongue)



Marcel
By Marcel Heitlager - 4/23/2010

Well, I reverted back to the previous update. Rebooted the machine. And now it works again. I'll try again updating later to try to figure out what's going on.


By Peter Jones - 5/5/2010

Hi Guys,



Bump de Bump....



We are seeing the same issue (all our PK's are GUIDs) and are rolling out a VS2010 version this weekend. We will be looking to change the SF code to get us going so any assistance you could give in terms of what we could/should change would be appreciated.



Cheers, Peter
By Peter Jones - 5/5/2010

Hi Guys,



The problem is in businesslayer.vb in the function GetIndexOfPrimaryKey on lines 2845 to 2850, and relates to the change to resolve the issue of a primary key containing a singlequote.



The code prior to the change used PrimaryKeyValues(lnCnt).ToString() to get the value of that portion of the key



The changed code uses CStr(PrimaryKeyValues(lnCnt)).Replace("'", "''") to get the portion of the key and address the issue of single quotes. The problem with this is that CStr doesn't work on a Guid.



An alternative using PrimaryKeyValues(lnCnt).ToString.Replace("'", "''") appears to fix the issue.



Cheers, Peter
By Peter Jones - 5/24/2010

Hi Guys,



I just wanted to reactivate this post to make sure it has been seen and the appropriate action taken in the next SF release.



Cheers, Peter
By Greg McGuffey - 5/25/2010

Thanks Peter! This one was missed, but is now in the list of issues we'll take a look at it this week and post as soon as the fix is done.
By Trent L. Taylor - 8/28/2010

Actually we had two threads going on this one. This was actually fixed and is in the build. It was fixed back in March, so if you weren't running the beta build you may not have noticed this. At any rate, it is fixed and in the 1.7.3 build.



http://forum.strataframe.net/Topic26310-10-1.aspx
By Peter Jones - 9/1/2010

Hi,

The problem identified above isn't fixed in 1.7.3.1

Cheers, Peter