Hi Group,
i have a foreign key in a table in sql server.i am using a dataset and
populating it with the contents of this table.my problem is that i am not
able to access the foreign key that i cretaed on this table in the
database.i am using a code something like this.if i check the number of
constraints on the table it prints 1,which is nothing but the primary key
constraint on this table,why doesn't it print 2 and show both primary and
foreign key constraint.i have tried most of the combinations in the code
below.
plz help.
DataSet myDataSet = new DataSet("myData Set");
myDataSet.Enfor ceConstraints=t rue;
SqlDataAdapter adpt=new SqlDataAdapter( "select * from "+TableName,con );
//adpt.MissingSch emaAction = MissingSchemaAc tion.AddWithKey ;
adpt.FillSchema (myDataSet,Sche maType.Mapped);
Response.Write( myDataSet.Relat ions.Count);
Response.Write( myDataSet.Table s["Table"].Constraints.Co unt);
//Response.Write( myDataSet.Table s["dtbl"].Constraints[0].ConstraintName );
//Response.Write( myDataSet.Table s["dtbl"].Constraints[0].GetType());
thanks in advance
--
Rajesh Tiwari
i have a foreign key in a table in sql server.i am using a dataset and
populating it with the contents of this table.my problem is that i am not
able to access the foreign key that i cretaed on this table in the
database.i am using a code something like this.if i check the number of
constraints on the table it prints 1,which is nothing but the primary key
constraint on this table,why doesn't it print 2 and show both primary and
foreign key constraint.i have tried most of the combinations in the code
below.
plz help.
DataSet myDataSet = new DataSet("myData Set");
myDataSet.Enfor ceConstraints=t rue;
SqlDataAdapter adpt=new SqlDataAdapter( "select * from "+TableName,con );
//adpt.MissingSch emaAction = MissingSchemaAc tion.AddWithKey ;
adpt.FillSchema (myDataSet,Sche maType.Mapped);
Response.Write( myDataSet.Relat ions.Count);
Response.Write( myDataSet.Table s["Table"].Constraints.Co unt);
//Response.Write( myDataSet.Table s["dtbl"].Constraints[0].ConstraintName );
//Response.Write( myDataSet.Table s["dtbl"].Constraints[0].GetType());
thanks in advance
--
Rajesh Tiwari