.NET调用带参数存储过程

       
        string str = "Data Source=.;Initial Catalog=SCR_2p0_Staging;Integrated Security=True";
        SqlConnection conn = new SqlConnection(str);
        conn.Open();
        string text = "dt_AdminTool_ServiceObjectChildList";
        SqlCommand command = new SqlCommand(text, conn);
       
command.CommandType = CommandType.StoredProcedure;
       
command.Parameters.Add("parentid", SqlDbType.Int).Value = id;//parentid 输入的参数
        SqlDataReader reader = command.ExecuteReader();
        reader["child_id"].tostring();
        reader["child_name"].tostring();//child_id和child_name都是数据库里的字段名

原文地址:https://www.cnblogs.com/shilei/p/1027953.html