Hi all,
I need some suggetion.
-
I have two different database.
-
1) Has information about all M series unit like m1,m2 etc
-
-
2) second one has information about all B series unit like b1,bls1,bls12 etc.
-
here, I have table called Unit which store all b series unit.
-
-
and I have .net form with a textbox. user can add a unit number like m1,b12 ect.
-
click on "Submit" button, how can I check which unit has been entered specially with unit stores in database table called "Unit" and then direct my database connection to appropriate database.
Please help and give me some suggetion on how can do that.
I have database connection set up and all but don't know how to make a textbox value with a database table to find a valid match and open a appropriate connection.
Thank You,
You are complicating the task what you want to do.
You can simplify the task by normalizing your database tables.
My idea is coming below:
1.Create the following two tables in database
UnitTypes(UnitTypeId,Name) -
Sample data : 1,B series
2,M series
Units(UnitId,UnitName,UnitTypeId)
Sample data : 1,b1,1
2,b2,1
3,m1,2
4,m2,2
You can relate UnitTypeId of Units with UnitTypeId of UnitTypes table.
2.Front desing as follows.
1. Combo Box to show Unit Types - Populate UnitTypes from UntitTypes table.
DisplayMember ="Name"
ValueMemebr = "UnitTypeId"
2. Text Box to enter unit.
3.Run the below logic in submit_click event once user entered new unit (eg : b1) and clicked submit button.
- Store the unitname and untiTypeId(Combobox.selectedvalue) in Units table.
I Hope it will help you.
Let me know if you have doubts.
- Balaji U