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...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

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