SqlConnection sqlConn = new SqlConnection(MyClass.GlobalConn());
sqlConn.Open();
try
{
string getAllBranch = "SELECT iBranch_num,LTRIM(RTRIM(sConstant)) FROM tblgobranch";
SqlCommand cmdgetAllBranch = new SqlCommand(getAllBranch, sqlConn);
SqlDataReader dRgetAllBranch=cmdgetAllBranch.ExecuteReader();
while (dRgetAllBranch.Read())
{
SqlCommand cmd = new SqlCommand("dbo.rvk_GetSalesPerItem", sqlConn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@piDateFrom", SqlDbType.Int).Value = FromDT1;
cmd.Parameters.Add("@piDateThru", SqlDbType.Int).Value = ToDT2;
cmd.Parameters.Add("@BRANCH", SqlDbType.NVarChar).Value = dRgetAllBranch[1].ToString();
cmd.Parameters.Add("@brNum", SqlDbType.Int).Value = dRgetAllBranch[0].ToString();
cmd.Parameters.Add("@PluCode", SqlDbType.NVarChar).Value = str1;
cmd.ExecuteNonQuery();
}
我在这里出错了
“已打开与此命令关联的数据读取器”
请帮我解决一下这个。