Change DT column header name gets error "no compiled code to run BC30561 : 'DataColumn' is ambiguous imported from the namespace and ....line 2"

i have the following invoke code which i’m trying to change dt_DataTable column header name from old to new as follows. i do not think there’s any error in my code because i ran it perfectly in the same Project in another smaller separate xmal sequence…how is it that when i put the code in my main file it is giving errors? is this a bug? :

out_DT = in_DT.Copy
For Each dc As DataColumn In out_DT.Columns
If dc.ColumnName=oldName Then
dc.ColumnName=newName
Exit For
End If

@byewiper

Welcome to the community

Ideally there should be a Next as well at the end in for each syntax

And try using system.data.dataColumn as per error this should solve

Cheers

2 Likes

Hi @byewiper
https://learn.microsoft.com/en-us/dotnet/visual-basic/language-reference/error-messages/name1-is-ambiguous-imported-from-the-namespaces-or-types-name

thanks, it worked.

1 Like

Hi Anil,
may i ask why it requires the full system.data.dataColumn here and earlier when i run in another xaml, it worked with simply DataColumn?

is there something i am missing ? how to debug this kind of issues in future?

@byewiper

After upgrade some of the namespaces are not fully recognized…check your imports…if system.data is added…few reference error are coming up… and also if datacolumn ia present in multiple namespaces also you might see error

This is happening in invoke code specifically…and general parttern of error you would see is that it could not recognize and then you need to add full namespace

Cheers

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.