Hi,I declare an object, surgeonRow within an if statement:if(addNewSurgeonChkBx.Checked == true){DataRow surgeonRow = dsAddAssessment.Tables["Surgeon"].NewRow();surgeonRow["sgnTitle"] = titleCboBx.SelectedValue;surgeonRow["sgnFName"] = fNameTxtBx.Text;surgeonRow["sgnLName"] = lNameTxtBx.Text;surgeonRow["estNo"] = Session["establishment"].ToString();dsAddAssessment.Tables["Surgeon"].Rows.Add(surgeonRow);}however when i try to use it again like this:if(addNewSurgeonChkBx.Checked == true){assessmentRow.SetParentRow(surgeonRow);}surgeonRow is highlighted and the build error "The name ''surgeonRow''does not exist in the class or namespace" is given.is there a way to reference it? I cant move theDataRow surgeonRow = dsAddAssessment.Tables["Surgeon"].NewRow();line out of the if statement to overcome this error, as it producesmore errors.Thanks. 解决方案 这篇关于在类或命名空间中不存在?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-22 12:15