A1VBCode Forums

Adding and retrieving data’s from two different tables


http://www.a1vbcode.com/vbforums/Topic31877.aspx

By shajilt - 2/16/2013

Hi There,

 

I am just a beginner with VB.NET; this is regarding a query about database join.

 

I have two tables in my database, one made as a master table and that we can call as ‘tbl_Master’ , the other one has got a grocery list in it and that we can call ‘tbl_groceries’.

 

For example,

A shopping cart program,.

 

Person A wants to buy some groceries, and I want create a record for Person A that he is buying groceries, like in the first column ‘Persons’ and second ‘Items’. So in first column will be adding Person A, and in the second one will be adding the ID’s of items for the other list tbl_groceries.

 

The same thing I want to retrieve to a DataGrid with detailed like “| Person A |Tea, Sugar, Coffee|”

 

So this is my concept, please can I have some hint how to make it happen,

 

Thank you,

By How2Prog - 3/23/2013

Hi shajilt !



Firstly, i'm sorry to tell you that your concept of database is wrong, you must create three tables, one for persons, the second for groceries, and the third is a table that contains all informations about Buying list.



so, begin by creating this tables, then you can retrieve data easily by simple join.



Good luck !