08-17-2009 01:36 AM
I am trying to find an easy database editor. Basicaly I want the editor to open the table like below but with current values
then just enter a new value anywhere on the table and press update so the table is updated in the database.
I googled for one but I couldn´t find one. Seems odd that I would be the first one who wants to edit a database trough labview.
08-17-2009 01:38 AM - edited 08-17-2009 01:38 AM
Hi Peter_Y,
do you need a database editor or a LabVIEW database editor? You can use a SELECT query to get your data and an UPDATE/INSERT command to write your changed data.
Mike
08-17-2009 01:42 AM
08-17-2009 01:46 AM
Peter_Y wrote:
Its going to be a part of a bigger Labview program so I need a labview one.
Hi Peter_Y,
ok, where do you have problems?
Mike
08-17-2009 02:04 AM
Well when I try to send the table back to the database unedited or edited I get this error
NI_Database_API.lvlib:Cmd Execute.vi->NI_Database_API.lvlib:DB Tools Insert Data.vi->Database Sample.vi<ERR>Exception occured in Microsoft OLE DB Provider for SQL Server: Insert Error: Column name or number of supplied values does not match table definition. in NI_Database_API.lvlib:Rec Create - Command.vi->NI_Database_API.lvlib:Cmd Execute.vi->NI_Database_API.lvlib:DB Tools Insert Data.vi->Database Sample.vi
Since I havent changed anything I find that odd.
08-17-2009 07:50 AM
08-17-2009 07:55 AM
Are you using the database toolkit from NI? I think is should be a database tool in that toolkit( some sort of simple table reader app). But I have not used it since Labview 7.0 so I am somewhat rusty regarding that tool 😉
08-17-2009 07:56 AM
Dare i guess that the table is a matrix of strings?
My experience says that labview doesn't automatically add ' to strings so you might have to make an export function.
One approach is to make the table as a cluster identical to the database and work that way somehow.
I'm pretty sure it's a format issue.
/Y
08-17-2009 08:21 AM
You have three problems -
First - the insert VI expects a cluster with an element for each column, as mentioned in the previous post, so giving it an array won't help.
Second - the insert VI won't help you, as it inserts data into the table, whereas you want to update the table.
Third - to update a table, you need to know which row to update (the SQL UPDATE command requires a WHERE clause). Visual Studio can do this because it integrates with Jet and SQL Server, so it knows all about the table's structure. LabVIEW does not.
There might be some .NET control you can use in LabVIEW (e.g. you can probably bind a DataTable or DataView directly an SQL Server table), but if not, you will be forced to write some code which will need, at the very least, to know what the key to the table is.
08-17-2009 08:48 AM
Coq Rouge
Yeah that was what I thought when I started but I can´t find any. Then I thought: "There has to be an example of that, its so basic".
Yamaeda
I wish there were only strings. But no there are boolean and int aswell.
tst
I have made a small VI that updates a table with a value using a SQL query. But with that VI I have to first choose table from a drop down menu, then what column from a drop down menu, write the RunNumber (some code taken from an example) so the the where query can find the right row then the new value. And that VI only works for strings for the moment. I have to make different kind of querys for different data types. Its a way but I woud like to just have a table where I could write a new value in the table, press enter or a update button or something and the value would automatically be updated to the database.
.NET is an option I´m not very found of since I have not worked with .NET before but I will look into it.
I am attaching my small update VI if anyone else finds this threads and it works for them