Jump to content

.NET type conversions in LabVIEW


Recommended Posts

You can't do that! Your LabVIEW code really is equivalent to this .Net code which will definitely throw an error!

int stringdata[] = {1, 2};
String string = new String(stringdata);
SqlString sql = (SqlString)string;       // throwing an error

and String is not an SqlString in a long shot and neither is an SqlString a String, as it does not inherit from String at all. It is its own object type.

Maybe .Net does some super magic behind the scenes and the C# code you wrote is valid but purely from a type compatible point of view reinterpreting the String object o as SqlString isn't a direct compatible conversion.

The proper code construct would be something along the lines of:

SqlString sql = new SqlString(o);

In LabVIEW use the SqlString contstructor that allows to pass in a String paremeter for the initialization.

Edited by rolfk
Link to comment
  • 2 months later...

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.