Specified cast is not valid with Guid SQL Server

Stimulsoft Reports.NET discussion
Post Reply
lutin7812
Posts: 6
Joined: Wed Mar 20, 2019 7:08 pm

Specified cast is not valid with Guid SQL Server

Post by lutin7812 »

Hi, I just came across this error with SQL Server 2014 and Stimulsoft v2020.2.3 when trying to run a master/detail report with 2 tables which have pk and fk column type of uniqueidentifier (guid) and a parameter for the relation link: specified cast is not valid.
I thought that the bug was fixed long years ago.
In fact the problem come from that when you add a datasource from SQL Server connection, default column type for those tables are of type long and not guid. After correcting manually the wrong column type from long to guid, it works fine.

Is it a bug, or I'm doing something wrong?
Olivier
Lech Kulikowski
Posts: 7344
Joined: Tue Mar 20, 2018 5:34 am

Re: Specified cast is not valid with Guid SQL Server

Post by Lech Kulikowski »

Hello,

Please send us a sample report with test data that reproduces the issue for analysis.

Thank you.
lutin7812
Posts: 6
Joined: Wed Mar 20, 2019 7:08 pm

Re: Specified cast is not valid with Guid SQL Server

Post by lutin7812 »

Hi, there's no test case that I can send, I've solved the problem.
But you can test yourself, just add a new datasource from SQL Server with a table that has a PK of type "uniqueidentifier".
You'll see in the pk column property in the dictionnary that the type is "long" and not "guid".

So there after, if you add a child table with pk and fk of type unique identifier, and make the link with parameter you'll get the error "specified cast is not valid", because uniqueidentifier columns are by default seen as long and not guid.
Regards,
Olivier
Lech Kulikowski
Posts: 7344
Joined: Tue Mar 20, 2018 5:34 am

Re: Specified cast is not valid with Guid SQL Server

Post by Lech Kulikowski »

Hello,

Thank you for the detailed information.

We will try to fix it in the next builds.

Thank you.
Post Reply