Click here to Skip to main content
15,903,385 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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


What I have tried:

'table' argument cannot be null.
Parameter name: table 
Posted
Updated 5-Jul-17 20:35pm

1 solution

Which line fails?

No one can really answer this for you, we would need your project and have to run it ourselves.

Use the debugger to look at the failing line and see which variable is null, then track that variable and work out why.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900