MissingMappingAction

J

Jim Heavey

I have been trying to figure out why when I set the MissingSchemaAction=
Error, I am getting an error. I have run out of ideas why this is
occurring. I know that I could choose the "passthrough" setting and all
would be well, but I want to understand why it is not happening - what
property am I not setting correctly?

I have enclosed everything about this situation as I can think of.

Here is the DDL for my small table (just a primary key, not foreign
keys)

CREATE TABLE [SkatingClubs] (
[ClubID] [uniqueidentifier] NOT NULL CONSTRAINT
[DF_SkatingClub_ClubID] DEFAULT (newid()),
[ClubName] [char] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT
NULL ,
CONSTRAINT [PK_SkatingClubs] PRIMARY KEY CLUSTERED
(
[ClubID]
) ON [PRIMARY]
) ON [PRIMARY]
GO

Here is how I set the table up in code...

DataTable dtClubs = new DataTable("SkatingClubs");

dtClubs.Columns.Add("ClubID",typeof(Guid));
dtClubs.Columns["ClubID"].AllowDBNull=false;
dtClubs.Columns["ClubID"].Unique=true;

dtClubs.Columns.Add("ClubName", typeof(string));
dtClubs.Columns["ClubName"].AllowDBNull=false;
dtClubs.Columns["ClubName"].MaxLength=50;
dtClubs.Columns["ClubName"].Unique=false;

// set up primary key for Clubs Table
DataColumn[] pkClubs = { dtClubs.Columns["ClubID"] };
dtClubs.PrimaryKey=pkClubs;
ds.Tables.Add(dtClubs); // add to the dataset

da.MissingMappingAction=MissingMappingAction.Error ;
da.MissingSchemaAction=MissingSchemaAction.Error ;
daFill(dtClubs);

Here is the Proc that I am executing (a little stripped down...)

select ClubID, ClubName
from dbo.SkatingClubs
set @recCount = @@ROWCOUNT


I get the following error "Missing Table Mapping when
TableMapping.DatasetTable='SkatingClubs'"

Any ideas as to what the "MissingMapping" might be?
 
M

Mahesh ChandraMouli[MVP]

Hi,

Check this url,
http://www.fawcette.com/vsm/2003_09/magazine/features/ferr
acchiati/default_pf.aspx

I hope this helps you.

Regards
Mahesh ChandraMouli
Microsoft .NET MVP|MCAD
-----Original Message-----
I have been trying to figure out why when I set the MissingSchemaAction=
Error, I am getting an error. I have run out of ideas why this is
occurring. I know that I could choose the "passthrough" setting and all
would be well, but I want to understand why it is not happening - what
property am I not setting correctly?

I have enclosed everything about this situation as I can think of.

Here is the DDL for my small table (just a primary key, not foreign
keys)

CREATE TABLE [SkatingClubs] (
[ClubID] [uniqueidentifier] NOT NULL CONSTRAINT
[DF_SkatingClub_ClubID] DEFAULT (newid()),
[ClubName] [char] (50) COLLATE
SQL_Latin1_General_CP1_CI_AS NOT
NULL ,
CONSTRAINT [PK_SkatingClubs] PRIMARY KEY CLUSTERED
(
[ClubID]
) ON [PRIMARY]
) ON [PRIMARY]
GO

Here is how I set the table up in code...

DataTable dtClubs = new DataTable("SkatingClubs");

dtClubs.Columns.Add("ClubID",typeof(Guid));
dtClubs.Columns["ClubID"].AllowDBNull=false;
dtClubs.Columns["ClubID"].Unique=true;

dtClubs.Columns.Add("ClubName", typeof(string));
dtClubs.Columns["ClubName"].AllowDBNull=false;
dtClubs.Columns["ClubName"].MaxLength=50;
dtClubs.Columns["ClubName"].Unique=false;

// set up primary key for Clubs Table
DataColumn[] pkClubs = { dtClubs.Columns["ClubID"] };
dtClubs.PrimaryKey=pkClubs;
ds.Tables.Add(dtClubs); // add to the dataset

da.MissingMappingAction=MissingMappingAction.Error ;
da.MissingSchemaAction=MissingSchemaAction.Error ;
daFill(dtClubs);

Here is the Proc that I am executing (a little stripped down...)

select ClubID, ClubName
from dbo.SkatingClubs
set @recCount = @@ROWCOUNT


I get the following error "Missing Table Mapping when
TableMapping.DatasetTable='SkatingClubs'"

Any ideas as to what the "MissingMapping" might be?

.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top