Microsoft Script Control 1.0 and ASP.NET

  • Thread starter Thread starter Harry Simpson
  • Start date Start date
H

Harry Simpson

My boss is an ol' Microsoft Script Control 1.0 script guru. So when we needed to calculate fees he wanted to use the Script Control interopted to feed in a script (VBS) along with "objects" and then just run it to calc all the fees and save them into a datatable.

Of course when i run the following I get an error:

Private Sub CalculateTheQuote()

Dim results As String

Dim obj As New MSScriptControl.ScriptControlClass

obj.Language = "VBScript"

Dim objAnswer As New A

Dim tbParams As DataTable

tbParams = objAnswer.GrabParameterTable

'when the following line runs it errs out

'System.InvalidCastException - No such interface supported

obj.AddObject("Params", tbParams, False)

End Sub



Something simple works like:



results = obj.Eval("4 + 4")



But is anyone using this control interopted?? Any good resources for this? ie using this control with ASP.NET?



TIA

Harry
 
the script control only supports com objects that support the IUnknown interface. you will will need to build com wrappers for any .net objects you want to expose to the script engine.

-- bruce (sqlwork.com)


My boss is an ol' Microsoft Script Control 1.0 script guru. So when we needed to calculate fees he wanted to use the Script Control interopted to feed in a script (VBS) along with "objects" and then just run it to calc all the fees and save them into a datatable.

Of course when i run the following I get an error:

Private Sub CalculateTheQuote()

Dim results As String

Dim obj As New MSScriptControl.ScriptControlClass

obj.Language = "VBScript"

Dim objAnswer As New A

Dim tbParams As DataTable

tbParams = objAnswer.GrabParameterTable

'when the following line runs it errs out

'System.InvalidCastException - No such interface supported

obj.AddObject("Params", tbParams, False)

End Sub



Something simple works like:



results = obj.Eval("4 + 4")



But is anyone using this control interopted?? Any good resources for this? ie using this control with ASP.NET?



TIA

Harry
 
Thanks Bruce,

I was afraid of that....

is .NET Scripting engine any good....any luck with it?

TIA
Harry

the script control only supports com objects that support the IUnknown interface. you will will need to build com wrappers for any .net objects you want to expose to the script engine.

-- bruce (sqlwork.com)


My boss is an ol' Microsoft Script Control 1.0 script guru. So when we needed to calculate fees he wanted to use the Script Control interopted to feed in a script (VBS) along with "objects" and then just run it to calc all the fees and save them into a datatable.

Of course when i run the following I get an error:

Private Sub CalculateTheQuote()

Dim results As String

Dim obj As New MSScriptControl.ScriptControlClass

obj.Language = "VBScript"

Dim objAnswer As New A

Dim tbParams As DataTable

tbParams = objAnswer.GrabParameterTable

'when the following line runs it errs out

'System.InvalidCastException - No such interface supported

obj.AddObject("Params", tbParams, False)

End Sub



Something simple works like:



results = obj.Eval("4 + 4")



But is anyone using this control interopted?? Any good resources for this? ie using this control with ASP.NET?



TIA

Harry
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top