.net 数据集错误:位置0处没有行

.net 数据集错误:位置0处没有行,.net,ironpython,.net,Ironpython,我对这个错误感到非常困惑,不知道该继续查找哪里。。下面的代码抓取一个客户列表,如果客户在数据库搜索中没有列出任何条目(计数值=0),则在调用main()的所述列表上迭代 这在上周运行得很好,但今天,只要做了最小的更改(注释SQL查询),当我在断点中查看的所有列出的数据集都有索引为[0]的行时,就会在选定客户(而不是所有客户)上抛出索引器 此时我甚至没有调用任何行,它在main(self,customer)上抛出异常,customer是一个字符串 def __init__(self):

我对这个错误感到非常困惑,不知道该继续查找哪里。。下面的代码抓取一个客户列表,如果客户在数据库搜索中没有列出任何条目(计数值=0),则在调用main()的所述列表上迭代

这在上周运行得很好,但今天,只要做了最小的更改(注释SQL查询),当我在断点中查看的所有列出的数据集都有索引为[0]的行时,就会在选定客户(而不是所有客户)上抛出索引器

此时我甚至没有调用任何行,它在main(self,customer)上抛出异常,customer是一个字符串

    def __init__(self):
        self.ui = wpf.LoadComponent(self, 'storageInvoicing.xaml')

        self.databaseHead = 'db'
        self.databaseDet = 'db'

        customerList = invoiceQuery("SELECT DISTINCT(custno) from db order by custno")

        #self.invoiceNumber = invoiceQuery("SELECT TOP 1 invoicenumber FROM db order by invoicenumber desc")
        self.invoiceNumber = invoiceQuery("SELECT TOP 1 invno FROM db ORDER BY invno DESC")

        self.invoiceNumber = str(self.invoiceNumber.Tables[0].Rows[0][0])

        self.start_time = time.time()

        self.startDate = '10-28-2019'
        self.endDate = '11-03-2019'
        self.gstRate = 0.10

        for i in range(0, len(customerList.Tables[0].DefaultView)):
            customer = customerList.Tables[0].Rows[i][0]
            customer = customer.replace("'", r"''")
            invoiceCheck = invoiceQuery("SELECT COUNT(*) from db where custno = '%s' and invoicedate = '%s'" % (customer, self.endDate))

            if invoiceCheck.Tables[0].Rows.Count > 0:
                if invoiceCheck.Tables[0].Rows[0][0] == 0:
                    try:
                        self.main(customer.strip()) ## THROWS EXCEPTION HERE ##
                    except Exception as e:
                        print(e)

        print("--- %s seconds ---" % (time.time() - self.start_time))
下面是直接从本地人那里得到的信息,它在一个客户身上抛出了错误:

customerList共有3334个数据行,如图所示> [3334]数据行

invoiceCheck共有1行,如图所示> [0]数据行

内存中所有当前数据集的索引都为0或更大,但我仍然在self.main(customer.strip())上收到错误

编辑:


更改日期范围会影响引发错误的客户列表

我设法解决了这个问题,原来是SQL中的数据问题,删除并重新导入表解决了这个问题。

我设法解决了这个问题,原来是SQL中的数据问题,删除并重新导入表解决了这个问题