please help! - find rows and check, URGENT!! :(
i have four text boxes, a user enters four three figure numbers into these boxes, i then conbine them into on value, adding .'s between each value:
tx1 tx2 tx3 tx4
| | | |
txtAll = 194.003.003.003
i want to look into the dataset and read the table held on the sql server, then check to see if the field "IPAddress" in any row matches the "txtAll" and if there is display a message otherwise input the data into the table.
my code is:
Code:
Private Sub btnDisplay_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDisplay.Click
txtAll.Value = (tx1.Value & "." & tx2.Value & "." & tx3.Value & "." & tx4.Value)
Dim SQLchkIP As String = "(IPAddress = '" & textAll.Value & "')"
Dim fndRows As DataRow() = dstSSDNetworkHardwareList.Tables("tblNetworkHardware").Select(SQLchkIP)
If fndRows.Length <= 0 Then
lblMessage.Text = "OK!"
Else
lblMessage.Text = "Already in use!"
End If
End Sub
at the moment there are 5 rows in the table, but even if i use the line:
[CODE[Dim fndRows As DataRow() = dstSSDNetworkHardwareList.Tables("tblNetworkHardware").Select[/CODE]
i.e select all, it still return the value of 0 into fndRows..!!!!
please help.
Tom
:confused: :confused: :eek: :confused: