Click here to Skip to main content
15,897,704 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Experts.

I have Mutliple Tables in My Access Database with passport No. as Table Names. And All Tables have same Columns.

Now My Question is How could i call particular table into DataGridview.

Example : I have taken 1 TextBox, 1 Button, And 1 DataGridview.

When I Enter Passport No. in TextBox and Clicking on Button, The DataGridView is to be updated with particular Passport No's Table().

Please give suggestion or any reference to get solution.


Thanks in Advance..

I am New to Dotnet. Please dont Missunderstand for my question.
At least i am not getting how start code it.
Posted

1 solution

first of all you better change your table design to having single table for all the passport No/Type.

example :

TableforType1
Col1           col2
val11            val12


TableforType2
Col1           col2
va21            val22


can be change to MyTable
TypeID     Col1      col2
1          val11     val12
2          val21     val22
3          val31     val32
1          val12     val13


TypeTable
ID      TypeName
1       Type A
2       Type B
3       New Type


by using above two tables you can handle many types without creating new tables for each new type.

when you need to retrieve data for type 1 for example ;
SQL
select m.Col1, m.col2 from MyTable m join TypeTable t on m.TypeId = t.ID where t.TypeName ='Type A'

so you don't need build runtime sql statements or creating complex logic on deciding which database table to select.
 
Share this answer
 
Comments
satya.Sw 26-Dec-14 3:37am    
Thank You So Much Boss.
But, If i do like this. Can I use all Tables.
Example :
I have each Table Like This.
S.no CurrentPlace TransferredTo RequestedBy ApprovedBy Date
1 Mydin McDonalds George Srikant 10/10/2014
2
Every Week I Have to Update each Table.
Can I Retrieve and Update Tables according to this.
DamithSL 26-Dec-14 3:48am    
read 11 important database designing rules which I follow[^]
you better separate user details and transfer details in to two tables. all the users will have unique key and user name, email etc.. in one table
2nd table you can keep userprimarykey and transfer details like CurrentPlace TransferredTo RequestedBy ApprovedBy Date

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900