Return the column name?
am 30.05.2005 07:13:49 von Bob The ASP Builder
I use Access database with an ASP frontend.
db contains a tabel called 'mytable' containing an unknown number of
columns.
I want to call the db and find out the names of column 2 och 3 ( out
of for example 0, 1 , 2, 3, 4)
Or a list or string containing all the names of all the columns (apart
from the ID column)
How can I do that? -
Either retrieve the names
Or find a script already doing the whole thing
Re: Return the column name?
am 30.05.2005 08:45:16 von Bob The ASP Builder
On Mon, 30 May 2005 07:13:49 +0200, Bob The ASP Builder
wrote:
>I use Access database with an ASP frontend.
I actually found this little piece of code doing the right thing for
me
for each column in RS.fields
if column.Properties("IsAutoIncrement") then
Else
Response.Write column.name
Response.Write "
"
End If
next
Thanks to myself
Re: Return the column name?
am 30.05.2005 09:16:02 von Jon
an alternative to that would be:
for each column in RS.fields
if column.name <> "IdField" then Response.Write column.name & "
"
next
Just a suggestion to keep your code a bit shorter and also if you have any
fields that use Autonumber than your Id Field (unlikely but possible) it
won't write these either.
--
Jon
warpedpixel@gmail.com
Look at that dead pixel on your screen! *SLAP* Gotcha!
"Bob The ASP Builder" wrote in message
news:1idl9111d49b2hu0crhkdla4kv1jmf2asn@4ax.com...
> On Mon, 30 May 2005 07:13:49 +0200, Bob The ASP Builder
> wrote:
>
>>I use Access database with an ASP frontend.
>
> I actually found this little piece of code doing the right thing for
> me
>
> for each column in RS.fields
> if column.Properties("IsAutoIncrement") then
> Else
> Response.Write column.name
>
> Response.Write "
"
> End If
> next
>
> Thanks to myself
>
Re: Return the column name?
am 30.05.2005 09:30:58 von Jon
May also not work coz of the nature of your problem. Never mind. It's 8:30
in the morning ... I don't quite function yet! :op
--
Jon
warpedpixel@gmail.com
Look at that dead pixel on your screen! *SLAP* Gotcha!
"Jon" wrote in message
news:u%23FWxdOZFHA.1868@TK2MSFTNGP14.phx.gbl...
> an alternative to that would be:
>
> for each column in RS.fields
> if column.name <> "IdField" then Response.Write column.name &
> "
"
> next
>
> Just a suggestion to keep your code a bit shorter and also if you have any
> fields that use Autonumber than your Id Field (unlikely but possible) it
> won't write these either.
>
> --
> Jon
> warpedpixel@gmail.com
> Look at that dead pixel on your screen! *SLAP* Gotcha!
> "Bob The ASP Builder" wrote in message
> news:1idl9111d49b2hu0crhkdla4kv1jmf2asn@4ax.com...
>> On Mon, 30 May 2005 07:13:49 +0200, Bob The ASP Builder
>> wrote:
>>
>>>I use Access database with an ASP frontend.
>>
>> I actually found this little piece of code doing the right thing for
>> me
>>
>> for each column in RS.fields
>> if column.Properties("IsAutoIncrement") then
>> Else
>> Response.Write column.name
>>
>> Response.Write "
"
>> End If
>> next
>>
>> Thanks to myself
>>
>
>