match up textbox value to database tabel

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • arial
    New Member
    • Sep 2007
    • 109

    match up textbox value to database tabel

    Hi all,

    I need some suggetion.
    Code:
    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,
  • balame2004
    New Member
    • Mar 2008
    • 142

    #2
    Originally posted by arial
    Hi all,

    I need some suggetion.
    Code:
    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(UnitT ypeId,Name) -
    Sample data : 1,B series
    2,M series

    Units(UnitId,Un itName,UnitType Id)
    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(Comb obox.selectedva lue) in Units table.

    I Hope it will help you.

    Let me know if you have doubts.

    - Balaji U

    Comment

    • arial
      New Member
      • Sep 2007
      • 109

      #3
      Thank You Balaji U,

      I can't use combo box as, my list is really big and it will grow over the time.
      So, I like user to typed in their unit and bring up the records for that perticular unit.

      Please suggest something without combo box.

      Thank You,

      Comment

      • deric
        New Member
        • Dec 2007
        • 92

        #4
        So, are you going to follow Balaji's suggestion? With his suggested database structure, you can add more unit type (series) without creating another table for it.

        I'm confused with what you stated.
        1. Do you have two different database or just two different tables in one database?
        2. Is the user going to input only one unit number at a time? Or can he input a comma-separated unit numbers?

        Comment

        • balame2004
          New Member
          • Mar 2008
          • 142

          #5
          Originally posted by deric
          So, are you going to follow Balaji's suggestion? With his suggested database structure, you can add more unit type (series) without creating another table for it.

          I'm confused with what you stated.
          1. Do you have two different database or just two different tables in one database?
          2. Is the user going to input only one unit number at a time? Or can he input a comma-separated unit numbers?
          Hey Arial,


          Your idea does not sound good and it consumes more space since you are trying to maintain different database/tables for each type of units.

          How can you identify the unit type. Unit name itself?. If so it does not sound good.

          Unit types 'B Series', ' M Series', 'T Series' should be inserted into UnitTypes table and combo box should be populated with unit types from UnitTypes table.

          You should allow user to enter unit name (eg : b1) and select unit type(eg: B Series) from combox box. So you can easily identify and process the unit type which is entered by the user.



          - Balaji U

          Comment

          • arial
            New Member
            • Sep 2007
            • 109

            #6
            Actually its a two different system, unit with M series and B series.

            Database is already designed and in place on different server.

            I am doing a front end app. to pull up the data using a common application.

            So, that why I need to make a value of textbox to match with atleast one unit table. meaning I think I have to search a whole unit table to see if there is a match. If it is not in that table then it is in other table and open that database connection to pull rest of the other recrods.

            Thank You,



            I

            Comment

            Working...