Click here to Skip to main content
15,066,326 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
hi all
i have a drop down list connected with sqldatasource
and fill with some "Room Code"
i want
when user select one of these code's and click on Ok
this should happen:
find the record that has St_Code = session["stcode"] //its get us who want to get the room?
then when it founded set or update column Room_Code of that record to dropdown selected item
its really simple way to say it :D
what should i do ? if you need to see my codes i will send it but im not sure need it!
i just want to update a single record with the value of dropdown list
for more understanding
ST_CODE = Student Code that means student registered number
and ROOM_CODE = Student room code that means wich room for wich student registred

What I have tried:

nothing know and i've not trying any thing yet
and here is my dropdown code i just connected to the database

SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["DatabaseConnectionString1"].ToString());
protected void Page_Load(object sender, EventArgs e)

protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)

Updated 24-Oct-17 21:20pm
Karthik_Mahalingam 24-Oct-17 23:33pm
what is st_code, room code?
not clear
Use Improve question to add more info to the question.
san2debug 25-Oct-17 0:38am
Can you explain clear description and share your code here

1 solution

Write a parameterized query on your dropdown's OnSelectedIndexChanged event to update the record in the table.

something like below..

Update [tablename] set Room_Code = [dropdown value] where St_Code = session["stcode"]

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