sir, i made the page_load as public,then the results shown below. public partial class Default2 : System.Web.UI.Page { public void Page_Load(object sender, EventArgs e) { TextBox t1 = new TextBox(); t1.ID = "TextBox1"; form1.Controls.Add(t1); } protected void Button1_Click(object sender, EventArgs e) { SqlConnection con = new SqlConnection("Server=localhost;uid='sa';pwd='sa';DataBase=master"); SqlCommand com=new SqlCommand("insert into table1 values('"+TextBox1.Text+"')",con); SqlDataReader rr=com.ExecuteReader(); } } ---------------------------- CS0103: The name 'TextBox1' does not exist in the current context Line 24: { Line 25: SqlConnection con = new SqlConnection("Server=localhost;uid='sa';pwd='sa';DataBase=master"); Line 26: SqlCommand com=new SqlCommand("insert into table1 values('"+TextBox1.Text+"')",con);//this line in Red Color(error portion) Line 27: SqlDataReader rr=com.ExecuteReader(); Line 28: