You are viewing limited content. For full access, please sign in.

Question

Question

SDK Script activity. Datatype problem when running. (solved)

asked on June 20, 2018 Show version history

Good day all.  Has anyone come across the following error. "Column requires a valid Data Type".  See attachment.  The code runs and produces the expected output in Visual Studio. All imports are present and correct for the script I hope. The message is obviously self explanatory but it doesn't tell me on which line the error is,  so with the amount of lines of code I have, that makes it rather difficult to correct the error.  Is there a way I can find out which line it's not happy with ?

Just to clarify, the code builds without errors but throws the data type error when it is run.

Regards,

Colin.

 

Update 1 :

I've used a process of code elimination, so I know what block of code it lies in. See below. I can now at least see where it is. Something to do with the Type.GetType call possibly.

Dim NewColumn As DataColumn = New DataColumn("ExpiryDate")

NewColumn.DataType = Type.GetType("DateTime")

dtWorkingTable.Columns.Add(NewColumn) 

And there a quite a few more of these, all with datetime or string specification.

Update 2 :

The following code appears to have stopped the error by explicitly adding system.

 

Dim NewColumn As DataColumn = New DataColumn("ExpiryDate")

NewColumn.DataType = System.Type.GetType("System.DateTime")

dtWorkingTable.Columns.Add(NewColumn)

Capture.PNG
Capture.PNG (9.87 KB)
0 0

Replies

replied on June 20, 2018 Show version history

My VB is rusty, but I think you can also use the type directly. It's safer to not use a string.

Dim NewColumn As DataColumn = New DataColumn("ExpiryDate")
NewColumn.DataType = GetType(DateTime)

 

 

0 0
replied on June 20, 2018

Thanks Devin. I'll make a note of that also. yes

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.