Dim myconn As New SqlConnection("server=(local);uid=sa;pwd=yy0122;database=wy")
Dim mycomm As New SqlCommand
Dim myset As New DataSet
Dim mydata As New SqlDataAdapter
Dim a As Integer
Dim str As String
str = "select * from py where XX='" & "XX" & "'"
mycomm.Connection = myconn
mycomm.CommandType = CommandType.Text
mycomm.CommandText = str
mydata.SelectCommand = mycomm
mydata.Fill(myset)
a = myset.Tables(0).Rows.Count()
MessageBox.Show("XX" & a, "条记录")