icon

CodeTrigger   Forum

Code Generation For C#, WPF, WCF, SQL SERVER/ORACLE/MYSQL and Visual Studio 2013-2017

HomeGeneral

General Discussion Board - Please post questions, answers, (polite) opinions, and use-cases. Moderators reserve the right to amend the text/subject line or re-categorise the post to better suit the forum configuration if necessary.

Specified Cast is not valid Messages in this topic - RSS

migrator
03/12/2017
migrator
Administrator
Posts: 63
migrator
migrator
Administrator
Posts: 63
Hi - I'm trying the program. Tutorial WPF app: At this step: Step 4 - Select Business Objects. Click the Business objects tab. There will be a slight delay while CodeTrigger builds up a Business Domain Model based on your selections so far. After which you will be presented with a list of business objects. ... there is no BO generated and an error: "Specified cast is not valid". I tried even selecting only one single table an I still get this. VS2017 with MS SQL 13.0.4001.0 on localhost. How can I fix this ? Thanks !
0 link
03/12/2017 migrator
Administrator
Posts: 63
migrator
migrator
Administrator
Posts: 63
Hi
If you could send a schema definition file (zipped) of your database tables we will be happy to look into this in detail.
However one thing that might be helpful for you to investigate further:
Even when you select only one table which has simple fields, say 2 integer columns, if that table has a relationship (foreign key etc) to other tables, those related tables will also be parsed. So the problem may lie with a table you didnt explicitly select. To verify this, try it on a simple table with no relationships. Then examine the relationships on the original single table you tried previously, i believe this will point you to the table thats actually causing the error.

You can then 'fix' the problematic table by changing the problem field type to a more commonly used suitable field type.
However we would still be interested in knowing the schema definition of the related table that caused the error.
0 link
03/12/2017 migrator
Administrator
Posts: 63
migrator
migrator
Administrator
Posts: 63
I created a DB with a single table and had the same issue:


CREATE TABLE [dbo].[iso.Language_tb](
[Code] [varchar](5) NOT NULL,
[Documentation] [nvarchar](100) NOT NULL,
CONSTRAINT [iso.Language.Code_pk] PRIMARY KEY CLUSTERED
(
[Code] ASC
)
)
GO


Thanks for your help
0 link
03/12/2017 migrator
Administrator
Posts: 63
migrator
migrator
Administrator
Posts: 63
Looks like the problem is the '.' In your table name. Its not coping very well with that naming convention. If you replace the '.' to '_' ie dbo.iso_language_tb then it works
edited by migrator on 12/3/2017
0 link