Lesson 3 Practice Exercise Convert Type Error

Hello all. I am currently learning in Academy and am a novice with c# (still learning it). I have no real experience with Visual Basic, so I have been doing all the exercises in c#. I have noted that it let’s you know that c# support is experimental atm, so I am curious to know if this is an issue due to that or due to my own newbishness.

Here is where I have my problem:

clubMembers = name.Select("[Club Member]=‘Yes’")

this throws System.InvalidOperationException.

“Cannot implicitly convert type ‘object’ to ‘System.Data.DataRow’. An explicit conversion exists (are you trying to cast?)”

I am still learning c#, so I feel it likely I just need pointed at what I need to know do do this. Is there anyone who could point me to the documentation where I need to read up?

Edit to add:

Also if someone could confirm/correct my understanding of why this is happening I would appreciate it. My interpretation of this error based on what I have read is that the method is returning an object, something like returning the cell of a spreadsheet but not the contents therein. Is that right?

1 Like

Hello @Rich0315
clubMembers variable should be array of Datatow


check once, please

Thanks

2 Likes

I believe I have it all set up correctly (unless, as mentioned above, c# should use a different method that I don’t know):

Edit to add:

I forgot to include in this snip, but the read CSV does go to names.

I’m not sure how this site works exactly, but I would like to bump this topic because my issue persists.

https://docs.microsoft.com/en-us/dotnet/api/system.data.datatable.select?view=netframework-4.8

Unless I am reading it wrong (which is possible given I am still a beginner), the documentation above for DataTable.Select(string) returns a DataTable. That is the command I am using, and I have typed it correctly. I even checked the sql expression, and I believe it is correct too.

Everything about this seems to have beet typed correctly, but I would like that to be confirmed if someone can do so. I suspect I may just be encountering a problem with the experimental state of c# support. I need to confirm that though because otherwise I will just keep working this problem looking for a solution. If no solution exists then I would like to move on.

Thank you.

I ran into the same issue in a C# project today.

Here’s what I’m trying to do (in pseudocode; I’m actually using Assign):

myList = new System.Collections.Generic.List<UiPath.Core.Window>()

myList's type is System.Collections.Generic.List<UiPath.Core.Window>.

Hi @eeskildsen @Rich0315

It would be awesome if you could register the bugs directly from Studio, see here:

This way those go directly to our bug tracker and for our team to consider :slight_smile: