[Solved] Insert values into the table depending on the selected dropdown value


what did you try so far?

there is no problem in having the table name coming from a DropDown, it’s more about understanding and designing the Data Access layer for your application. Do you have a save button in your WebForm and are you composing the SQL code dynamically in the code behind or using stored procedures?

starting point to connect to SQL Server and execute a command is generally similar to the following (if you do not use ORM like Entity Framework):

using (varconn = new SqlConnection(connectionString)) 
using (var cmd = conn.CreateCommand(...)))
{ 
    conn.Open();

    cmd.ExecuteNonQuery();
}

if you need more ideas about how to use EF (or simply a DAL technique) with ASP.NET (MVC or Web Forms), see my answer here: https://stackoverflow.com/a/7474357/559144

5

solved Insert values into the table depending on the selected dropdown value