labviewnoob Posted July 6, 2009 Report Share Posted July 6, 2009 Does anyone have any simple vi about getting data from the database. I am currently doing a project which requires me to do a search panel. From the search panel, i need to compare and retrieve the data similar to my search from the first name column. I have read the labview example available but i still could not understand after trying to place the component similar to my requirement on my own. Many Thanks. Quote Link to comment
ragupathi Posted July 6, 2009 Report Share Posted July 6, 2009 hi, May i know which type of data base you are using like MS- SQL, MS Acess and so on... Does anyone have any simple vi about getting data from the database. I am currently doing a project which requires me to do a search panel. From the search panel, i need to compare and retrieve the data similar to my search from the first name column. I have read the labview example available but i still could not understand after trying to place the component similar to my requirement on my own. Many Thanks. Quote Link to comment
labviewnoob Posted July 6, 2009 Author Report Share Posted July 6, 2009 hi, May i know which type of data base you are using like MS- SQL, MS Acess and so on... im using ms access. thanks. Quote Link to comment
jcarmody Posted July 6, 2009 Report Share Posted July 6, 2009 im using ms access. thanks. Do you have the Database Connectivity Toolkit? If not, there are several ADO toolkits available. http://performancemicrowave.com/sql_LV.html http://jeffreytravis.com/lost/labsql.html http://www.ib-berger.com/index.php?action=adotool_en Quote Link to comment
labviewnoob Posted July 6, 2009 Author Report Share Posted July 6, 2009 Do you have the Database Connectivity Toolkit? If not, there are several ADO toolkits available. http://performancemicrowave.com/sql_LV.html http://jeffreytravis.com/lost/labsql.html http://www.ib-berger.com/index.php?action=adotool_en Hi. I've the database toolkit on my computer already. it just the vi part which i do not quite understand. Quote Link to comment
Michael Aivaliotis Posted July 6, 2009 Report Share Posted July 6, 2009 Hi. I've the database toolkit on my computer already. it just the vi part which i do not quite understand. What does your table structure look like and what data do you want to get from it? Quote Link to comment
labviewnoob Posted July 7, 2009 Author Report Share Posted July 7, 2009 What does your table structure look like and what data do you want to get from it? Occupant Table -FirstName -LastName -Age -IdentificationNo. -DateOfBirth I wish to have a search tab to allow the user to search by the first name. I might be required to search the first name and the last name fields in the later part of my project. i read the labview example vi but i do not understand the array part. Many Thanks. Quote Link to comment
JustinThomas Posted July 7, 2009 Report Share Posted July 7, 2009 Can you post the vi you already have? We can give you some suggestions on it Quote Link to comment
labviewnoob Posted July 7, 2009 Author Report Share Posted July 7, 2009 Hi. this is the labview example vi which I have in my labview. The 2nd for loop is the 1 which i do not understand. I hope you can give me suggestions on how I could modify the vi to suit my requirements. Many Thanks. Quote Link to comment
Karissap Posted July 8, 2009 Report Share Posted July 8, 2009 Hi. this is the labview example vi which I have in my labview. The 2nd for loop is the 1 which i do not understand. I hope you can give me suggestions on how I could modify the vi to suit my requirements. Many Thanks. The second loop just formats the data into a table. The VI "Get Database Information" just returns the information about the tables in the database. If you want to do a search on one of the tables you will need to do a select query. In the NI example finder look at the example "Sixtypes Select" this gives an example of how to extract different types of data from a table. To do a search you will need to add in a clause. Here is an example of a vi you might use to search for part of a first name in your table. Database Select.vi Quote Link to comment
labviewnoob Posted July 9, 2009 Author Report Share Posted July 9, 2009 Thanks kari for attaching your example. I've tried to replicate a similar vi to yours as im currently using v8.5 but i got an error. Also, i found that everytime i press run in the udl vi, the path will change back to the previous udl. When i tried to change the path in the block diagram, the indicator in the front panel will display no such path. could the error be related to my udl? i copied it from the get database information vi because i could not find it in the connectivity component & search. I tried with my other tables & i still gt the same error. Sorry that i could not attach my database here. Database 672009.vi Quote Link to comment
labviewnoob Posted July 10, 2009 Author Report Share Posted July 10, 2009 Thanks all. I've managed to solve the error. i used the wrong database. Quote Link to comment
labviewnoob Posted July 10, 2009 Author Report Share Posted July 10, 2009 (edited) one last question for this thread. when a user enters an input to search for the name, i would like to retrieve other important data which is in other table. for example, the address or the telephone from the personaldetails. how should i go about getting the address from the personaldetails table? do i need to create a sub vi or do i need something else? Edited July 10, 2009 by labviewnoob Quote Link to comment
Karissap Posted July 17, 2009 Report Share Posted July 17, 2009 (edited) one last question for this thread. when a user enters an input to search for the name, i would like to retrieve other important data which is in other table. for example, the address or the telephone from the personaldetails. how should i go about getting the address from the personaldetails table? do i need to create a sub vi or do i need something else? You could do this by just changing your database query, there are lots of examples on how to return data across multiple tables like this: SQL Basics: Query multiple tables For example, you could do something like this: Edited July 17, 2009 by Karissap Quote Link to comment
labviewnoob Posted July 17, 2009 Author Report Share Posted July 17, 2009 Thanks kari for the example. Quote Link to comment
labviewnoob Posted July 20, 2009 Author Report Share Posted July 20, 2009 After modifying my vi, the table now display all my database data in the table when i have no input into the control. how can i default the table to show nothing when there is no input?Database.vi Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.