Hi there.
What you could do is execute a SELECT * query and then loop through the Fields available in the Recordset, comparing their Name property against the value you're looking for. The code below shows what I mean:
Code:
<%
Dim oField ' As ADODB.Field
Dim oRecordset ' As ADODB.Recordset
Dim oConn ' As ADODB.Connection
Dim nameToCheck
Dim nameExists
' The column name you're looking for
nameToCheck = "ID"
nameExists = false
' Create connection
Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open "YourConnectionString"
Set oRecordset = oConn.Execute("SELECT * FROM YourTable")
For Each oField In oRecordset.Fields
If oField.Name = nameToCheck Then
nameExists = True
Exit For
End If
Next
oRecordset.Close()
oConn.Close()
Set oConn = Nothing
Set oRecordset = Nothing
Response.Write("Field " & nameToCheck & " found " & nameExists)
%>
I am curious why you need to perform this check. Are you working on generic code, or coding against an unknown database?
Cheers,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.