I am accessing a Oracle Db and both my primary and foreign keys are defined
as RAW(16) when I try to add the relationship I get a exception stating
"These columns don't currently have unique values.". I know the columns are
unique, do DataRelation's support Byte[] columns? If I change my select to to
call RAWTOHEX on the PK and FK column it works.
OracleConnection cConn = new OracleConnection( ... );
OracleDataAdapter cDA = new OracleDataAdapter( "select COUNTRY_PK,
COUNTRY_NAME from country", cConn );
OracleDataAdapter rDA = new OracleDataAdapter( "select COUNYTRY_FK,
REGION_NAME from region", cConn );
// the following changes will make this work
//OracleDataAdapter cDA = new OracleDataAdapter( "select
RAWTOHEX(COUNTRY_PK), COUNTRY_NAME from country", cConn );
//OracleDataAdapter rDA = new OracleDataAdapter( "select
RAWTOHEX(COUNYTRY_FK), REGION_NAME from region", cConn );
cConn.Open();
DataSet cDS = new DataSet();
cDA.Fill( cDS, "COUNTRY");
rDA.Fill( cDS, "REGION" );
cConn.Close();
// throws exception here - COUNTRY_PK and COUNTRY_FK are defined as RAW(16)
DataRelation countryRel = cDS.Relations.Add("CountryRegions",
cDS.Tables["COUNTRY"].Columns["COUNTRY_PK"],
cDS.Tables["REGION"].Columns["COUNTRY_FK"] );
countryRel.Nested = true;
|