|
Posted by raylopez99 on 07/18/07 20:12
On Jul 15, 2:40 am, David Portas
<REMOVE_BEFORE_REPLYING_dpor...@acm.org> wrote:
> On 15 Jul, 01:05,raylopez99<raylope...@yahoo.com> wrote:
> > Problem:
>
> > I replicated, using Frasier "Pro Visual C++/CLI" (2006), Chap 12, a
> > database that has a relationship between two tables, called Content
> > and Author, using a common column, called "AuthorID". I used the
> > Server Explorer insider Visual Studio 2005 to do this. It worked.
>
> > Now I tried the exact same thing from Visual Studio 2005 but this time
> > using C# not C++ as my language of choice. The interface is slightly
> > different, but I made sure everything was done as before. I used the
> > Server Explorer 'GUI' to do this, clicking and following the 'wizards'
> > as before.
>
> > But somehow, when using C# rather than C++, I get this error when
> > attempting to create a relationship between tables when using two
> > identical columns called "AuthorID": "the columns in table Authors do
> > not match an existing primary key or UNIQUE constraint" Why? The
> > columns are the same. I even tried (and this made no difference)
> > copying and pasting columns from one table to the other, but still I
> > get this error.
>
> > I tried everything, even deleting columns and rebuilding them, which
> > eventually created a new error that fatally compromised the database
> > (if you're curious, and as an aside, it created this error: "'Authors'
> > table - Unable to modify table. Cannot insert the value NULL into
> > column 'AuthorID', able 'DCV3_CSharp.dbo.Tmp_Authors'; column does
> > not allow nulls. INSERT fails.
> > The statement has been terminated.")
UPDATE: I figured out a workaround. The bug occurs before the tables
are saved. So, you should create the tables, save them, then try the
"Relationship" (which is simply a CONSTRAINT between foreign and
primary keys). THis then works from within Visual Studio 2005.
So it's a minor bug after all.
RL
Navigation:
[Reply to this message]
|