How to show the data from sql by any chosen value from dropdown menu?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Fitore
    New Member
    • May 2012
    • 1

    How to show the data from sql by any chosen value from dropdown menu?

    I have created a database with name algorithmA4 and with atributes ID(primary key), Row (int), State (varchar).
    So, I have to chose any number from dropdown menu (in the Row I have added 50 numbers from 1-15)to show the states in an textarea below that contain that number.
    For example: I chose number 5, and after I push the button GO should show in the text area (England, Austria, Germany, France,(states that I have in database with this number))

    Please help me!
  • raghurocks
    New Member
    • May 2012
    • 46

    #2
    use this code..
    sqlcommand cmd=new sqlcommand("sel ect state from algorithmA4 where ID=5",connectio n object);
    connectionobj.o pen();
    sqldatareader dr=cmd.executer eader();
    while(Dr.read() )
    {
    textbox1.text+= dr["state"].tostring()+"," ;
    }
    textbox1=textbo x1.remove(textb ox1.length-1,1);

    Comment

    • raghurocks
      New Member
      • May 2012
      • 46

      #3
      i think this will help you

      Comment

      Working...