0

有 datatable.while 向该行添加值时出现错误。每次我向数据表中的该数据行添加一个新值时,都使用 for 循环。

my code
=======
dt3 = ds1.Tables(0)
                For Each q In dt3.Rows
                    chkphone = q("PHONE").ToString
                    chkdphone = Regex.Replace(chkphone, "[^\d]", "")

                    'MessageBox.Show(chkdphone)


                    If (chkdphone.Length = 10) Then
                        Dim NTN As DataRow = dt4.NewRow
                        NTN(0) = chkdphone.ToString
                        dt4.Rows.Add(NTN)

                    ElseIf (chkdphone.Length >= 10) Then
                        rsltstring = chkdphone.Substring(chkdphone.Length - 10, 10)

                        Dim NTN1 As DataRow = dt4.NewRow
                        NTN1(0) = rsltstring.ToString
                        dt4.Rows.Add(NTN1)
                    End If
                Next

when i debug the code in first itself am getting error in the line NTN(0) = chkdphone.ToString



error :  could not find column 0
4

0 回答 0