473,378 Members | 1,523 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Msscript.ocx C# wrapper problem

1
Hello,

I am having a problem using msscript.ocx with C# VS2005 and DateTime objects, specifically the method 'AddObject'. I have added a reference to the control and below illustrates the issue:

ScriptControlClass scripter = new ScriptControlClass();
bool bRet = false;

try
{
scripter.Language = "VBScript";
scripter.AllowUI = false;

DateTime dtTest = DateTime.Now;

scripter.AddObject("test", dtTest , false); // Throws exception : InvalidCastException

bRet = (bool) scripter.Eval("test > 25 Mar 2005");
}
catch (Exception ex)
{
... code to display error
}
finally
{
System.Runtime.InteropServices.Marshal.ReleaseComO bject(scripter);
scripter = null;
}

I would very much appreciate it if anyone can shed light on how I can get this working so that date time objects can be used and successfully evaluated as dates. i.e. no point converting to numbers as I require evaluation in the script as shown in the example - "test > 25 Mar 2005".
Jul 19 '06 #1
0 3111

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Svenn-Ivar Svendsen | last post by:
I'm implementing a windows application with generic support for scripting, and I'm using the microsoft script control (msscript). For vbscript/jscript I'm happy, but with python I got problems...
2
by: BcOnline | last post by:
Thanks
4
by: user | last post by:
I have several vb.net apps that use the MSScript control to provide basic scripting. On one machine in particular, these apps refuse to start, stating: An Unhandled exception of type...
22
by: linwu02 | last post by:
I am trying to write a Wrapper for our web wrapping engine, Cameleon. Currently Cameleon is able to answer certain SQL queries but with a restriction that all SQL queries must have a predicate....
9
by: Julien Biezemans | last post by:
Hi! Here is the problem: I'd like to restrict local filesystem stream operations to one directory just like a root jail. fopen('/file.bin') would actually open /some/path/file.bin. One goal...
2
by: =?Utf-8?B?cGh5cw==?= | last post by:
I need to write a C# application that uses unmanaged C++ code. I created a C++/CLI wrapper to C++ code and encountered the following problem. Any time I try to instantiate a wrapper in C#...
3
by: bobc | last post by:
Using SQL Server 2000... I wrote a wrapper to call a sub proc (code provided below). The intended varchar value returned in the output parameter of each proc is a string implementation of an...
2
by: Udi | last post by:
Hi all, Does anyone know if there's an MSScript.ocx ready for 64 bits? My (WinForm) application fails to load on 64 bit due to the fact the ocx is compied to 32 bits. The thing is, my...
3
by: srbakshi | last post by:
Hey all, I'm stuck with the following: The mysql_real_escape_string(conn, to, from, strlen(from)) function does not return the escaped string. So how can I go about writing a wrapper for it so...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.