how to determine whether a datarow is null or not

  • Thread starter Thread starter guoqi zheng
  • Start date Start date
G

guoqi zheng

Dear sir,

I am trying to find a row in a dataset. I know I can define a primaryKey and
use rows.find(key) to locate this row.

However, very often this row does not exists, what can I use to determine
whether this row exists or not??
Dim objSet As New DataSet
objSet.ReadXmlSchema("e:\abc\test.xsd")
objSet.ReadXml("e:\abc\test.xml")
objSet.Tables(0).PrimaryKey = New DataColumn() {objSet.Tables(0). Columns("GroupId")}
Dim datarow As DataRow = objSet.Tables(0).Rows.Find(9)

Now I need to determine whether it finds the row with key=9 or not? How can
I do it?

regards,

Guoqi Zheng
http://www.ureader.com
 
I haven't used vb.net in a while but I believe it was:

If datarow is nothing Then
'do stuff for null
Else
'do stuff for exist
End If

or if you just want to do stuff when it exists:

If not datarow is nothing Then
'do something
End If

Chris
 
Back
Top