ExecuteReader: Connection property has not been initialized

前端 未结 7 1480
广开言路
广开言路 2021-01-01 08:29

ExecuteReader: Connection property has not been initialized.

my coding is

protected void Button2_Click(object sender,          


        
7条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-01 09:07

    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; 
    

提交回复
热议问题