Here's my code. I am not able to set TableName variable, it is throwing an exception Must declare the table variable "@TableName"
public DataTable getAllDataFromTable(String TableName)
{
cmd.CommandText = "select * from @TableName";
cmd.Parameters.AddWithValue("@TableName", TableName);
da.SelectCommand = cmd;
da.Fill(dt);
return dt;
}