下面的代码供参考
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Con.Open()
= "SELECT * from 表名 Where ID = " & Me.TextBox1.Text
Da.Fill(Ds, "TMP")
If Ds.Tables("TMP").Rows.Count > 0 Then
MsgBox("找到" & Ds.Tables("TMP").Rows.Count.ToString & "条记录")
Else
MsgBox("没找到符合条件的记录")
End If
Con.Close()
End Sub