Forums

ASP

This topic is locked

Check if recordset field exists

Posted 21 Jan 2002 10:16:16
1
has voted
21 Jan 2002 10:16:16 Viktor Farcic posted:
Can I do this inside of page?

Viktor Farcic

TalkZone Manager

Replies

Replied 21 Jan 2002 10:47:40
21 Jan 2002 10:47:40 Owen Eastwick replied:
Do you mean?

<% If (RecordsetName.Fields.Item("FieldName".Value) <> "" Then %>
<Whatever HTML>
<% Else %>
<Whatever Else HTML>
<% End If %>

Regards

Owen.

Multiple Parameter UD4 / Access 2000 Database Search Tutorial:
www.tdsf.co.uk/tdsfdemo
Replied 21 Jan 2002 17:06:43
21 Jan 2002 17:06:43 Viktor Farcic replied:
I know that but it produces error if there's no such field in table. I'm interested in checking if field itself (not data) exists.

<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
Do you mean?

&lt;% If (RecordsetName.Fields.Item("FieldName".Value) &lt;&gt; "" Then %&gt;
&lt;Whatever HTML&gt;
&lt;% Else %&gt;
&lt;Whatever Else HTML&gt;
&lt;% End If %&gt;

Regards

Owen.

Multiple Parameter UD4 / Access 2000 Database Search Tutorial:
www.tdsf.co.uk/tdsfdemo
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>

Viktor Farcic

TalkZone Manager
Replied 22 Jan 2002 12:29:06
22 Jan 2002 12:29:06 Michele Mariotti replied:
With this procedure you can obtain all the field's name:

&lt;%
For Each xField in Rs.Fields
Response.write xField.Name & "&lt;br&gt;"
Next
%&gt;

now you can create a procedure that search your field:

&lt;%
FindField = "TryIt"
FindFlag = False

For Each xField in Rs.Fields

If Trim(Ucase(xField.Name)) = Trim(Ucase(FindField) then
FindFlag = True
End If

Next
%&gt;


Reply to this topic