Here you can take table name as value from textbox, with that name you can create table at database.
protected void Page_Load(object sender, EventArgs e)
{
}
private string GetConnectionString()
{
//sets the connection string from your web config file. "DBConnection" is the name of your Connection String
return System.Configuration.ConfigurationManager.ConnectionStrings["DBConnection"].ConnectionString;
}
public bool DeleteData(string TableName)
{
SqlConnection connection = new SqlConnection(GetConnectionString());
connection.Open();
string sqlStatement = "CREATE TABLE " + TableName + "" + "(studentid INTEGER PRIMARY KEY," + "stuname CHAR(50), stuaddress CHAR
(255), stubalance FLOAT)";
SqlCommand sqlCmd = new SqlCommand(sqlStatement, connection);
sqlCmd.ExecuteNonQuery();
connection.Close();
return true;
}
protected void Button1_Click(object sender, EventArgs e)
{
string a = TextBox1.Text;
DeleteData(a);
}