SqlParameter[] sp = { new SqlParameter("@nGridID",SqlDbType.BigInt), new SqlParameter("@strDocID",SqlDbType.VarChar,16), new SqlParameter("@chType",SqlDbType.Char,1), }; sp[0].Value = nGridID; sp[1].Value = strDocID; sp[2].Value = chType; SqlDataReader reader = DBHelper.GetReader("usp_fitGetDocFilePath", sp); reader.Read(); string stret = (string)reader[0]; reader.Close();
Read()後忘了Close(),導致程序報錯:「已有打開的與此命令相關聯的 DataReader,必須首先將它關閉。」code