H
Heinz Kiosk
I am adding JScript scripting to a C# ADO.NET application that uses
System.Data
I have derived a new class called BusinessTable from DataTable
The following sample script generates a type mismatch error when it is
compiled:
///////////////////////////
import System.Data;
import MyLib.MyObjects;
static function SomeFunction( p_Table : BusinessTable )
{
var descColumn : DataColumn = p_Table.Columns("SomeColumnName");
}
//////////////////////
However the following script works perfectly. The only difference is
wrapping the returned result in an object. The problem is as if the compiler
thinks that the Columns accessor returns something incompatible with a
DataColumn but if I can trick it then everything works perfectly at
runtime.
///////////////////////
import System.Data;
import MyLib.MyObjects;
static function SomeFunction( p_Table : BusinessTable )
{
var someColumn : DataColumn = Object(p_Table.Columns("SomeColumnName"));
}
////////////////////////
Many attempts to use either base methods or members of the BusinessTable
class seems to result in a type-mismatch from the compiler.
If I Messagebox.Show p_Table("SomeColumName").GetType().ToString() then it
correctly shows System.Data.DataColumn. So there is an example of a call
that both doesn't claim a type mismatch and shows the correct type being
returned.
What is going on? How can I fix my Invoke/CreateItem calls on the scripting
engine to stop it so that I can write scripting code without lots of silly
Object wrappers on my calls?
Thank you for your assistance.
Tom
System.Data
I have derived a new class called BusinessTable from DataTable
The following sample script generates a type mismatch error when it is
compiled:
///////////////////////////
import System.Data;
import MyLib.MyObjects;
static function SomeFunction( p_Table : BusinessTable )
{
var descColumn : DataColumn = p_Table.Columns("SomeColumnName");
}
//////////////////////
However the following script works perfectly. The only difference is
wrapping the returned result in an object. The problem is as if the compiler
thinks that the Columns accessor returns something incompatible with a
DataColumn but if I can trick it then everything works perfectly at
runtime.
///////////////////////
import System.Data;
import MyLib.MyObjects;
static function SomeFunction( p_Table : BusinessTable )
{
var someColumn : DataColumn = Object(p_Table.Columns("SomeColumnName"));
}
////////////////////////
Many attempts to use either base methods or members of the BusinessTable
class seems to result in a type-mismatch from the compiler.
If I Messagebox.Show p_Table("SomeColumName").GetType().ToString() then it
correctly shows System.Data.DataColumn. So there is an example of a call
that both doesn't claim a type mismatch and shows the correct type being
returned.
What is going on? How can I fix my Invoke/CreateItem calls on the scripting
engine to stop it so that I can write scripting code without lots of silly
Object wrappers on my calls?
Thank you for your assistance.
Tom