Jump to content

Help With Database.


Recommended Posts

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.

Link to comment

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.

Link to comment

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.

Link to comment

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

post-8228-124702208379_thumb.png

Link to comment

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.

Database.jpg

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

Link to comment

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 by labviewnoob
Link to comment

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:

post-8228-124780871598_thumb.png

Edited by Karissap
Link to comment

Join the conversation

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

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