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
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