Member 11800040 Ответов: 1

Аргумент "таблица" не может быть нулевым. Имя параметра: таблица


Private Function GetEmployeeDetail() As DataTable
        Try


            Dim employeeDT = common.GetEmployeeMasterTable()
            employeeDT.TableName = "tblEmployeeMaster"
            Dim employeedtRow = employeeDT.Rows.Add

            If ViewState("EmployeeID") <> "" Then
                employeedtRow("pkEmployeeID") = ViewState("EmployeeID")
            Else
                employeedtRow("pkEmployeeID") = 0
            End If
            employeedtRow("EmployeeCode") = 0
            'employeedtRow("EmployeeStatusTypedetailID")=
            employeedtRow("CSLNumber") = txtCSLNo.Text
            employeedtRow("Rank") = IIf(txtRank.Text = "", 0, txtRank.Text)
            employeedtRow("SelectionYearTypedetailID") = cmbSelectListYear.SelectedValue
            employeedtRow("ServiceTypedetailID") = cmbService.SelectedValue
            employeedtRow("CadreID") = cmbCadre.SelectedValue
            employeedtRow("SubCadreID") = cmbSubCadre.SelectedValue
            employeedtRow("Title") = cmbTitle.SelectedValue
            employeedtRow("FirstName") = txtFirstName.Text
            employeedtRow("MiddleName") = txtMiddleName.Text
            employeedtRow("LastName") = txtLastName.Text
            'employeedtRow("LevelTypedetailID")=
            employeedtRow("DesignationTypedetailID") = cmbDesignation.SelectedValue
            If txtDateOfBirth.Text <> "" Then
                'employeedtRow("DateOfBirth") = Replace(Convert.ToDateTime(txtDateOfBirth.Text).ToString("dd/MM/yyyy"), "-", "/")
                employeedtRow("DateOfBirth") = Convert.ToDateTime(txtDateOfBirth.Text)
                '    'Convert.ToDateTime(txtDateOfBirth.Text)
            End If

            'If (Not IsDBNull(DataTable(0)("DateOfBirth"))) Then
            '    txtDateOfBirth.Text = common.ConvertToSmallDateTime(DataTable(0)("DateOfBirth"))
            'Else
            '    txtDateOfBirth.Text = ""
            'End I
            employeedtRow("BirthStateID") = cmbBirthState.SelectedValue
            employeedtRow("BirthDistrictID") = txtBirthDistrict.Text
            employeedtRow("BloodGroupTypedetailID") = cmbBloodGroup.SelectedValue
            employeedtRow("IdentificationMarks") = txtIdentificationMark.Text
            employeedtRow("Gender") = cmbGender.SelectedValue
            employeedtRow("DifferentlyAbledTypedetailID") = cmbDiffAbled.SelectedValue
            employeedtRow("MaritalStatusTypedetailID") = cmbMaritalStatus.SelectedValue
            employeedtRow("CategoryTypedetailID") = cmbCategory.SelectedValue
            employeedtRow("MotherTongue") = txtMotherTongue.Text
            employeedtRow("MotherName") = txtMotherName.Text
            employeedtRow("FatherName") = txtFatherName.Text
            employeedtRow("ReligiontypedetailID") = cmbReligion.SelectedValue
            employeedtRow("Community") = txtCommunity.Text
            employeedtRow("StateoforiginalResidenceID") = cmbStateResidence.SelectedValue
            employeedtRow("HomeTown") = txtHomeTown.Text
            'employeedtRow("NationalityTypedetailID")=
            If txtEntryInPService.Text <> "" Then
                employeedtRow("DateOfJoining") = Convert.ToDateTime(txtEntryInPService.Text)
            Else
                txtEntryInPService.Text = Convert.ToDateTime(DBNull.Value)


            End If
            employeedtRow("PrsntAddL1") = txtLAddress1.Text
            employeedtRow("PrsntAddL2") = txtLAddress2.Text
            employeedtRow("PrsntCityID") = cmbLCity.SelectedValue
            employeedtRow("PrsntStateID") = cmbLState.SelectedValue
            employeedtRow("PrsnPinCode") = IIf(txtLPinCode.Text = "", 0, txtLPinCode.Text)
            employeedtRow("PrmntAddL1") = txtPAddress1.Text
            employeedtRow("PrmntAddL2") = txtPAddress2.Text
            employeedtRow("PrmntCityID") = cmbPCity.SelectedValue
            employeedtRow("PrmnStateID") = cmbPState.SelectedValue
            employeedtRow("PrmnPinCode") = IIf(txtPPinCode.Text = "", 0, txtPPinCode.Text)
            employeedtRow("EmailID1") = txtEmail1.Text
            employeedtRow("EmailID2") = txtEmail2.Text
            employeedtRow("PhoneOff") = txtOfficePhone.Text
            employeedtRow("PhoneRes") = txtResidencePhone.Text
            employeedtRow("Mobile") = txtMobile.Text
            employeedtRow("Fax") = txtFax.Text
            If txtGovtEntryDate.Text <> "" Then
                employeedtRow("DateOFEntry") = Convert.ToDateTime(txtGovtEntryDate.Text)
            End If
            employeedtRow("Achivement") = txtAchievement.Text
            'employeedtRow("Active")= 
            'employeedtRow("VigilanceStatus")=
            'employeedtRow("VigilanceStatusDate")=
            employeedtRow("Confirmed") = cmbWhetherConfirmed.SelectedValue
            If txtConfirmationDate.Text <> "" Then
                employeedtRow("ConfirmedDate") = Convert.ToDateTime(txtConfirmationDate.Text)
            End If
            'employeedtRow("CreatedBy") = Session.Item("UserName")
            'employeedtRow("CreatedDate") = Now()
            'employeedtRow("ModifiedBy")=
            'employeedtRow("ModifiedDate")=   
            employeedtRow("AttachPolice") = IIf(IsNothing(Session("PolicePath")), "", Session("PolicePath"))
            employeedtRow("AttachCast") = IIf(IsNothing(Session("CastPath")), "", Session("CastPath"))
            employeedtRow("AttachHigh") = IIf(IsNothing(Session("HighPath")), "", Session("HighPath"))
            employeedtRow("AttachGraduation") = IIf(IsNothing(Session("GraduationPath")), "", Session("GraduationPath"))
            employeedtRow("AttachMedical") = IIf(IsNothing(Session("MedicalPath")), "", Session("MedicalPath"))
            employeedtRow("AttachBirth") = IIf(IsNothing(Session("BirthPath")), "", Session("BirthPath"))
            'Return employeeDT
        Catch ex As Exception
            common.AddError("EIS", "frmEmpAddEdit.aspx", Session("EmployeeName"), ex, "Code", "Error in Code", System.Reflection.MethodBase.GetCurrentMethod().Name, Session("EmployeeID"))
            Throw
        End Try


Что я уже пробовал:

'table' argument cannot be null.
Parameter name: table 

1 Ответов

Рейтинг:
0

Michael_Davies

Какая линия терпит неудачу?

Никто не может ответить на этот вопрос за вас, нам нужен ваш проект, и мы должны запустить его сами.

Используйте отладчик, чтобы посмотреть на неудачную строку и увидеть, какая переменная является нулевой, а затем отследить эту переменную и выяснить, почему.