Parent Columns and Child Columns don't have type-matching columns

M

microsoft news

Hello,
i have a windows app project which is independent of the database, i.e. just
by changing the values in the config file i can connect to any kind of
database through any provider.
I have no problems when connecting to Oracle using the System.Oracle however
when i try to connect to Oracle using ODP, in one particular scenario it
gives the following error
"Parent Columns and Child Columns don't have type-matching columns". this
occurs when i try to add a relation to two tables within a dataset
I have no clue why this happens only in case of ODP and not in case of
System.Oracle.
The code has been given below:
Friend Shared Function Load(ByVal bpoID As Int32) As DataSet
Dim ds As DataSet
Dim spParams(10) As Object
Dim tableNames(9) As String
Dim provider As FrameworkBuilderDataProvider
Try
spParams(0) = bpoID
tableNames(0) = consTblBpo
tableNames(1) = consTblClassAttrib
tableNames(2) = consTblClassAttriblist
tableNames(3) = consTblClassAttriblistArgs
tableNames(4) = consTblClassImplements
tableNames(5) = consTblBpoMethod
tableNames(6) = consTblMethAttrib
tableNames(7) = consTblMethAttriblist
tableNames(8) = consTblMethAttriblistArg
tableNames(9) = consTblMethodImplements
provider = FrameworkBuilderDataProvider.GetInstance("")
ds = provider.ExecuteDataSet(consSpGetBpoBpoMethodFilter,
spParams, tableNames, consStrApplicationIdentifier)
Dim rel As DataRelation
Dim relBPO As String = "R_BPO"
Dim dsName As String = "DCs"
Dim colParent As DataColumn
Dim colChild As DataColumn
colParent = ds.Tables(consTblBpo).Columns(consColBPOID)
colChild = ds.Tables(consTblBpoMethod).Columns(consColBPOID)
ds.Relations.Add(relBPO, colParent, colChild) ---à (fails
by giving error Parent Columns and Child Columns don't have type-matching
columns.)
Return ds
Catch Ex As Exception
Throw New FWBuilderException(Ex.Message, Ex)
Finally
If Not ds Is Nothing Then
ds.Dispose()
End If
provider = Nothing
End Try
End Function
The above mentioned method call fails because the colParent is having
DataType as "Decimal" while the colChild is having dataType as "Int64(Long)"
, while we have checked in the database that both datatype of both the
columns are same.
Also such problem exist only with this method, there are so many methods
where we create the Relation in dataset but the same is not failing as the
datatype returned by ExecuteDataSet is same for both the columns.
Can someone please help me

Pooja Renukdas
 
R

Rami Saad

Hello,

have you tried explicit casting of one of the variables?
I had this problem before, and it was solved using casting.
Can you try this method and let me know if the problem is still not solved?

Regards,
Rami Saad
MEA Developer Support Center
ITworx on behalf of Microsoft EMEA GTSC
 

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