How to create textbox that will autoload text based on SQL data from DropDownList in VB.Net 2003?

244 views Asked by At

In my SQL database there is a table with the following columns

| Student ID | Course Code |

Both these columns can be found in other tables as well, and I'm creating a Web Form to input both Student ID (via Textbox) and Course Code (via DropDownList) data so that I can save and update it into the table above.

An additional feature I want to add is to include a read-only textbox besides both data to automatically get the Student Name and Course name once the data is inputted for user reference.

But I'm not sure how to do this. Any advise?

1

There are 1 answers

0
Romeo Berenyi On

You can use the "sqlcommand" of your client in VB and get all of these dates with a "SELECT FROM" command then you can fill up antyhing with these dates with help of an "sqladapter"

I made a simple code whic fill up an listbox you can modify a bit soo it will work for you

myconn.Open()
    COMMAND = New SQLiteCommand("SELECT (Name) FROM Folders", myconn)
    COMMAND.ExecuteNonQuery()
    Dim adapter As New SQLiteDataAdapter(COMMAND)
    Dim table As New DataTable
    adapter.Fill(table)
    ListBox1.DataSource = table
    ListBox1.ValueMember = "Name"
    myconn.Close()

Of cource you need to make a connection