ExecuteReader: Connection property has not been initialized ExecuteReader: Connection property has not been initialized asp.net asp.net

ExecuteReader: Connection property has not been initialized


use this and pass connection object :

 SqlCommand cmd=new SqlCommand ("insert into time(project,iteration)values('"+this .name1 .SelectedValue +"','"+this .iteration .SelectedValue +"')",conn);


After SqlCommand cmd=new SqlCommand ("insert into time(project,iteration)values('....Add

cmd.Connection = conn;

Hope this help


you have to assign connection to your command object, like..

SqlCommand cmd=new SqlCommand ("insert into time(project,iteration)values('"+this .name1 .SelectedValue +"','"+this .iteration .SelectedValue +"')");cmd.Connection = conn;