08-11-2009 10:50 PM
Hello everyone,
I meet a problem need someone's help.
I am trying to get excel file from database(I use access and store the excel file by use OLE object datatype) and then show the choosed file into activex container for modify and then save back to database.I have no idea how to convert the variant data to activex data that can use on next steps by use "variant to data".vi
Hope some one may help me.
Thanks
Tim
08-12-2009 03:21 AM
What is ActiveX data?
When you use an Excel Container you get a reference and ther should be a method/property where you can write the tables contents, I think it's a string datatype what you need then. So just convert your table from the database into a 2D String array using the Variant to Data. You might need to use nested For-Loops then to write the date to the excel container as strings.
Just have a look at some examples for excel in LabVIEW.
Hope this helps,
Christian
08-12-2009 10:01 AM
There are two separate issues here. The first is converting the data read from the database to an OLE object datatype. The second is to display it on the front panel.
As for the first: you are, for some unfathomable reason, storing an Excel file into a database. I have no idea why anybody would want to do this. Regardless, assuming you're using the database toolkit, or something similar, you're going to get a variant. I don't know if this would even work, but you would need to wire an automation refnum to the Variant to Data function. The class would probably be Excel.Workbook.
As for the second: there is no Excel container. So, even if you get the data out of the database and into a workbook object, you'd have no place to put it. There is a Microsoft Spreadsheet Control, but that's not an Excel workbook. You would need to copy the data from the workbook object into the Spreadsheet Control using the ActiveX methods of both. Or, you could save the workbook to file, and use a browser ActiveX control, allowing you to leverage the Excel plug-in for browsers.