Hi I'm relatively new to asp and I'm having a bit of trouble on one of my projects.
Basically I can't work out how to insert an item, that's been selected from a dropdownlist, into a table. I tried:
string queryString; queryString = "Insert INTO Details(Gender) VALUES(";
queryString += "'" + list1.SelectedItem.Value + "')";
However this didn't seem to work and I was wondering what bit of code I had to change to make it insert the selected item from the dropdownlist (list1)
Thanks!
Try list1.SelectedValue.
You should also use parameters instead of concatenating to the end of your SQL string. This leaves your application open for SQL injection attacks.
sivilian
0 comments:
Post a Comment