Link to home
Start Free TrialLog in
Avatar of mathieu_cupryk
mathieu_cuprykFlag for Canada

asked on

row.ItemArray = myRow.ItemArray not set to an instance of an object.

Object reference not set to an instance of an object.

 For Index As Integer = 0 To MaxPeriod - 1
                ' Get date period

                StoredProcName = dbName & ".dbo.usp_GetDatePeriodFromTo"
                cmd = dbManager.GetStoredProcCommand(StoredProcName)
                dbManager.AddInParameter(cmd, "@YEARMONTH", DbType.String, DtPeriod)


                DtPeriod = IncrementDate(DtPeriod, DateIndex)
                ' Put the yearmonth, start date ,and end date in a dataset
                myDs = dbManager.ExecuteDataSet(cmd)

                ' check myTable first
                Dim myRow As DataRow

                Dim myTable As DataTable = myDs.Tables(0)

                If myTable.Rows.Count >= 1 Then
                    myRow = myTable.Rows(Index)
                End If

                Dim row As DataRow = myTable.NewRow()

                row.ItemArray = myRow.ItemArray

                myTable.Rows.Add(row)  


            Next
           
ASKER CERTIFIED SOLUTION
Avatar of Si_Hibbard
Si_Hibbard
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mathieu_cupryk

ASKER

Good job!!!