Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

exists method for db column results? 1

Status
Not open for further replies.

gagz

Programmer
Nov 21, 2002
333
US
I have two stored procedure that get very similar data from two different databases. One of them gets a field called address3, one only goes up to address2.

is there a way in vb.net to say something like:

if (Exists(row("address3"))) Then
'do something with it
end if

reason i ask is because I try to check that field (by doing if row(&quot;address3&quot;) <> &quot;&quot;) even when my second stored procedure doesn't return it and it tells me it doesn't below to the table specified.

Thanks in advance.
 
You're looking for the .Contains method of the .Columns property of the DataTable:

If DataTable.Columns.Contains(&quot;myColumnName&quot;) Then
'the column is there
Else
'the column isn't there
End If

:)
paul
penny1.gif
penny1.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top