01-11-2011 04:12 AM
Hi,
I'm using the DAO (Data Access Object). My goal is two write/read in an Access Database.
Everything is good but I don't know how to refer a reference/pointer in Labview.
For example the Delphi code would be:
curField := recordset.Fields[0].Value := 1;
curField := recordset.Fields[1].Value := 'First record';
The Labview Fileds looks like (ignorw variant VIs. I was only trying something):
I would like to access Fields[x].Value but I have no ideea how to do it. If I use Invoke Node or Property Node I have only 3 methods (Append, Refresh, Delete) and 1 property (Count).
So the questions: how can I access (or refer) in Labveiew the Fields[x].Value ???
Thanks,
Paul
Solved! Go to Solution.
01-12-2011 04:59 AM
Hi,
I will try to explain my final goal.
I want to create an MS Access Database. I was able to open one, to create a table and fields (head of table), to read the fields, but I don't know how to write in a table.
I've read the msdn - DAO documentation, I've found some examples but everything is in Basic, C++, Delphi. In these programming languages it's easy, but I don't know how to translate some operators in LabView. As you can see in the previous post I need a refer operator for an object. I have the reference Fields and I want to access Fields(1).Value.
Maybe I'm on the wrong track. So if you have any suggestions please share them.
Thanks,
Paul
01-12-2011 05:05 AM - edited 01-12-2011 05:06 AM
Hi Paul,
what do you get if you connect a property node to the Fields reference? Is there any property available? If not, then you can try it like shown in the attached image. It's an example from Excel. There you can see how to get single elements.
Hope it helps.
Mike
01-12-2011 05:38 AM
Hi Mike,
Thanks for your ansewer.
If I attach a property node I have only the property "Counts" and if I attach a invoke node I have only three methods: "Append", "Delete" and "Refresh".
Here is something from msdn - DAO documentation:
To refer to a Field object in a collection by its ordinal number or by its Name property setting, use any of the following syntax forms:
Fields(0)
Fields("name")
Fields![name]
With the same syntax forms, you can also refer to the Value property of a Field object that you create and append to a Fields collection. The context of the field reference will determine whether you are referring to the Field object or the Value property of the Field object.
Documentation for Fields object: msdn - Fields object domcumentation
Regards,
Paul
01-12-2011 06:06 AM - edited 01-12-2011 06:07 AM
Hi Paul,
in my version there is also a Item method. If you also can find it, then it should be possible like in the attached image.
Mike
Edit: sorry, forgot to connect the count output to the loop counter!
01-12-2011 07:47 AM
Hi Mike,
Which DAO version are you using? Mine is 3.6 and I don't have Item property. (as you can see in attachment).
Can you please send to me (attache it) the small vi from which you made the screen-shot?
Thanks,
Paul
01-12-2011 07:52 AM
Hi Paul,
that's what i use.
Mike
01-12-2011 09:32 AM
Hi Mike,
I've copied the invoke node from your vi and it works. But the weird thing is that I'm only able to select those 3 methods (Append, Delete, Refresh). I only have to keep it like in your example and it works ( i cannot select Item method on my computer). It doesn't matter as long it works.
Thank you very much for your support.
Paul
01-13-2011 12:25 AM - edited 01-13-2011 12:26 AM
Hi Paul,
sorry, i didn't know that the item property is "privat stuff". You should be able to select it, if you follow this link and insert the "supersecretprivatstuff" line in your LabVIEW.ini.
Mike