Showing posts with label referencing. Show all posts
Showing posts with label referencing. Show all posts

Friday, March 23, 2012

How to reference datasets in custom code

Can datasets associated with a report be referenced in custom code? If so,
how? I've tried referencing them like one does in expressions in the report,
e.g., Fields!Personal_Amt_Paid.Value, but this does not work. I get the
error
"There is an error on line 6 of custom code: [BC30469] Reference to a
non-shared member requires an object reference."I doubt you can do it... The way you reference a parameter in code is
Report.Parameters!whatever...
So try Report.Dataset.something... How would it know which row?... probably
will not work...
you'll just have to pass the values in as parameters.
--
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Bob Kilmer" <Bob.Kilmer@.S.com> wrote in message
news:uODIYYrnFHA.1048@.tk2msftngp13.phx.gbl...
> Can datasets associated with a report be referenced in custom code? If so,
> how? I've tried referencing them like one does in expressions in the
> report,
> e.g., Fields!Personal_Amt_Paid.Value, but this does not work. I get the
> error
> "There is an error on line 6 of custom code: [BC30469] Reference to a
> non-shared member requires an object reference."
>

Wednesday, March 21, 2012

How to refer a column when the referencing column is an identity column

Hi all,

The requirement is to have a table say 'child_table', with an Identity column to refer another column from a table say 'Parent_table'..

i cannot implement this constraint, it throws the error when i execute the below Alter query,

ALTER TABLE child_table ADD CONSTRAINT fk_1_ct FOREIGN KEY (child_id)
REFERENCES parent_table (parent_id) ON DELETE CASCADE

the error thrown is :
Failed to execute alter table query: 'ALTER TABLE child_table ADD CONSTRAINT
fk_1_ct FOREIGN KEY (child_id) REFERENCES parent_table (parent_id) ON DELETE
CASCADE '. Message: java.sql.SQLException: Cascading foreign key 'fk_1_ct' cannot be
created where the referencing column 'child_table.child_id' is an identity column.

any workarounds for this ?it does not seem logical at all.
you have some column that's Identity and still you need it to be a FK column for some other table!!!

I don't see any chance for this to succeed.

All you can do is implement some logic in the SPROC to ensure the values in the Identity column are unique and do away with the Identity characteristics of this column.

Hope i've not confused you...|||The requirement is to have a table say 'child_table', with an Identity column to refer another column from a table say 'Parent_table'.. I'm afraid that either the requirement is wrong or you have misunderstood it. The values of the fields in a foreign key are determind by the parent not the child. This should be an identity in the parent and then a matching datatype in the child's foreign key (e.g. smallint, int etc).

HTH|||I'm afraid that either the requirement is wrong or you have misunderstood it. The values of the fields in a foreign key are determind by the parent not the child. This should be an identity in the parent and then a matching datatype in the child's foreign key (e.g. smallint, int etc).


Was thinking on the same line, but was not sure about this.

Thanks for re-enforcing my personal thoughts.