Adding a Relation - matching columns not appearing for selection

Posts   
 
    
Jamanga
User
Posts: 93
Joined: 21-Jul-2006
# Posted on: 12-Sep-2012 08:06:59   

Hi

I've inherited a legacy database which requires some changes... it has no FK relationships as db constraints, hence I was going to set them up the the LLBLGen designer. The problem is that LLBLGen is not giving me the option to match some columns for some datatypes which to me seem the same.

e.g. here are 2 of the table definitions. The TRAFFLOGS.TRAFFLOG_SCREENING_ID should be able to map to SCREENINGS.SCREENING_ID since they have the same datatypes, however when I try to do this within the designer, no columns appear.

CREATE TABLE dbo.TRAFFLOGS ( TRAFFLOG_ID numeric(6,0) IDENTITY NOT NULL, TRAFFLOG_RESOURCE_ID numeric(6,0) NOT NULL, TRAFFLOG_SCREENING_ID numeric(6,0) NOT NULL, TRAFFLOG_NUM tinyint NOT NULL, TRAFFLOG_PNOTE_USER numeric(6,0) NULL, TRAFFLOG_PNOTE_TEXT varchar(255) NULL, TRAFFLOG_TNOTE_USER numeric(6,0) NULL, TRAFFLOG_TNOTE_TEXT varchar(255) NULL, TRAFFLOG_PLAY_USER numeric(6,0) NULL, TRAFFLOG_PLAY_VALUE tinyint NULL, TRAFFLOG_ACTIVE tinyint NOT NULL, CONSTRAINT TRAFFLOGS_PK PRIMARY KEY(TRAFFLOG_ID) )

CREATE TABLE dbo.SCREENINGS ( SCREENING_ID numeric(6,0) IDENTITY NOT NULL, SCREENING_DATE datetime NOT NULL, SCREENING_PARENT_ID numeric(6,0) NOT NULL, SCREENING_TYPE_ID tinyint NOT NULL, SCREENING_SALES_VALUE decimal(8,2) NULL, SCREENING_SALES_MARGIN numeric(3,1) NULL, SCREENING_PNOTE_USER numeric(6,0) NULL, SCREENING_PNOTE_TEXT varchar(255) NULL, SCREENING_TNOTE_USER numeric(6,0) NULL, SCREENING_TNOTE_TEXT varchar(255) NULL, SCREENING_PLAY_USER numeric(6,0) NULL, SCREENING_PLAY_VALUE tinyint NULL, SCREENING_ACTIVE tinyint NOT NULL, SCREENING_COMMENT varchar(30) NULL, SCREENING_NOTIFICATION varchar(10) NULL )

Other columns types are working fine and I haven't seen this issue before, although typically the numeric datatype in other db has had a precision of at least 9. In this example both are showing as DBType=numeric, Length=6, Precision=6, Scale=0 within the LLBLGen Mapped Entity fields area though - so I'm not sure why it is thinking they are not the same datatype?

My system is LLBLGen 2.6 Final / VS 2010 / Sybase ASE 15.x DB

Plse let me know if you need anymore info.

Regards, James

Jamanga
User
Posts: 93
Joined: 21-Jul-2006
# Posted on: 12-Sep-2012 08:25:13   

Sorry should have mentioned version is October 9, 2009. Screenshot of non-match attached

Attachments
Filename File size Added on Approval
noRelations.png 17,611 12-Sep-2012 08:25.26 Approved
Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 12-Sep-2012 19:32:39   

Do these fields have different dataTypes in the database? Oh, is the SCREENING_ID defined as the PK?

Jamanga
User
Posts: 93
Joined: 21-Jul-2006
# Posted on: 13-Sep-2012 00:03:41   

Hi Walaa

The datatypes are identical, but the SCREENINGS table didn't have a defined PK which was the issue. Thanks so much for you tip!

Cheers, James

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 13-Sep-2012 06:33:03   

Hi James,

In order to make the relation possible you have to make the Screening .ScreeningId PK. To do that:

  1. Edit the Screening entity.
  2. Go to the ScreeningId field
  3. Turn on the checkbox "Is part of primary key".

Then try to make the relation.

David Elizondo | LLBLGen Support Team
Jamanga
User
Posts: 93
Joined: 21-Jul-2006
# Posted on: 13-Sep-2012 09:40:36   

Hi daelmo

I can't believe I never noticed this option - I ended up changing the db. Thanks for this tip also!

Cheers, James