DropDownList problem

V

Viktor Popov

Hi,
I have a WebForm on which I have 2 buttons: "Retreive" and "Insert"
When I push "Retreive" I would like to retreive info from my DataBase and to
make a DropDownList- DDL1 to show the result. The code is:
private void Retreive_Click(object sender, System.EventArgs e)
{
...........connection to DB, etc.
DDL1.Items.FindByText(DS.Tables[0].Rows[0][0].ToString()).Selected=true;
.......
}
It works. When I click on the button the exact information shows up in the
DDL1.
Than I would like to click on the "Insert" button and to insert the same
info or other if I change the Item in DDL1. I use this code and I know that
something is wrong, but I don't know what exactly:

private void Insert_Click(object sender, System.EventArgs e)
{
...........connection to DB, etc.
cmd.Parameters.Add(new SqlParameter("@ESTTYPEID", SqlDbType.TinyInt));
cmd.Parameters["@ESTTYPEID"].Value = Byte.Parse(DDL1.SelectedItem.Value);
.......
}

Could you tell me how could be accomplished my goal?

Thank you in advance!

Viktor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,890
Messages
2,569,971
Members
46,304
Latest member
hipznguyen14

Latest Threads

Top