我有 2 个数据集。命名为ds,ds1。数据集值包含这样的值
dataset(values from excel sheet)
--------
no phone title
91 9942321400 MR
91 9865015695 MR
91 9677031515 MR
91 9994828285 MR
91 9688104229 MR
dataset1 contain value like this(values from mysql table)
-------------------------------
phone
9942321400
9865015695
9677031515
比较 2 个数据集。如果数据集不等于 datset1 phone ,我们必须在记事本中写入该数据集 phone no 。但结果错误。
mycode
Dim i As Integer = 0
Do While (i <= ds1.Tables(0).Rows.Count - 1)
Dim phone As String = ds1.Tables(0).Rows(i).Item(1).ToString
Dim j As Integer = 0
Do While (j <= Ds.Tables(0).Rows.Count - 1)
Dim dumphone As String = Ds.Tables(0).Rows(j).Item(4).ToString
If (dumphone <> phone) Then
TextBox1.AppendText(a.ToString & "|" & b.ToString & "|" & c.ToString)
sw.WriteLine(TextBox1.Text)
TextBox1.Text = ""
End If
j = (j + 1)
'i = i + 1
Loop
i = (i + 1)
Loop
我在记事本中的结果
|91|9942321400|MR
|91|9942321400|MR
|91|9942321400|MR
|91|9942321400|MR
|91|9865015695|MR
|91|9865015695|MR
|91|9865015695|MR
|91|9865015695|MR
|91|9677031515|MR
|91|9677031515|MR
|91|9677031515|MR
|91|9677031515|MR
but expected output in notepad like this
----------------------------------------
91|9994828285|MR
91|9688104229|MR