Validation error : Database is not declared. But it is. BC30451

Hello,

I am building a system to :

  1. read 1.xls, save to dt table1
  2. read 2.xls save to dt table2
  3. find element of dt 2 in dt 1 and write to dt3
    4 print

Everything seem peachy, until I get :slight_smile:

Error ERROR Validation Error No compiled code to run
error BC30451: ‘DT1’ is not declared. It may be inaccessible due to its protection level. At line 2
error BC30451: ‘DT2’ is not declared. It may be inaccessible due to its protection level. At line 4
error BC30109: ‘LogMessage’ is a class type and cannot be used as an expression. At line 7
error BC30109: ‘LogMessage’ is a class type and cannot be used as an expression. At line 9
Variable ‘DT_1’ is missing. Please use Data Manager to recreate it. Main.xaml

Here my invoke code

’ Check and log if any match found
For Each row As DataRow In DT_Talent.Rows
Dim talentValue As String = row(“Talent”).ToString()
Dim matchingRows As DataRow() = DT_Mandat.Select(“Lots = '” & talentValue & “’ OR Critères = '” & talentValue & “'”)

If matchingRows.Length > 0 Then
    LogMessage("Match Found: " & talentValue)
Else
    LogMessage("No Match Found for: " & talentValue)
End If

Next

and a quick view of my main

we would recommend to avoid blackboxing by using the invoke code as the case can be implemented differently (essential / LINQ / Hybride)

However check that the invoke parameters are defining / using dt1,dt2…
And that all used variables are existing with the usage scope
Feel free to share with us a screenshot from it

About: LogMessage(…)

we could use Console.WriteLine(YourText)

You have to create arguments to the Invoke Code. Only the arguments are available in the code inside it.

Anyway, why are you doing this with Invoke Code when you could just use the For Each Row in Data Table and Filter Data Table activities?

Also you don’t need to use Build Data Table if you’re going to use Read Range to populate it. The Read Range will build it for you.

OK.

I just started again and i am getting very cranky at doing something so basic and not getting it to work. I am starting to believe that my xlsx files is the problem.

Your input is appreciated because I am at my with ends. At the every turn, the data refuse to be save to a datatable.

Talent.xlsx (10.0 KB)

use within the range field:
Excel.Sheets(“YourSheetName”)

Kindly note:

  • the initial topic was about the BC30451 error
  • we helped and solved with you

now a new topic is raised within the same old topic.
We prefer a straightforwad procedure

With this also others researchers are helped as with 1 Topic = 1 case they find faster solution for their similar case

Thanks for support

I stand corrected.

I will modify recreate a post and transfer you answer there

1 Like

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