Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 List all columns is a table
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

redbrad0
Advanced Member

USA
3725 Posts

Posted - 08 November 2001 :  09:53:36  Show Profile  Visit redbrad0's Homepage  Send redbrad0 an AOL message
how do i list all the columns in a table thru asp script? I tried using the TableEditor, but I think the table has to much data in it (about 300 mb) so I just need to list what column names are in that table.

Brad
Web Hosting with SQL Server @ $24.95 per month
Snitz Mod Archive

Kat
Advanced Member

United Kingdom
3065 Posts

Posted - 08 November 2001 :  10:31:53  Show Profile  Visit Kat's Homepage
Brad take a look here. (The summary looks good but I couldn't get to the site - it was down. You might want to try later.)

www.aspfaq.com/faq/faqShow.asp?fid=86

KatsKorner
Go to Top of Page

HuwR
Forum Admin

United Kingdom
20595 Posts

Posted - 08 November 2001 :  10:35:31  Show Profile  Visit HuwR's Homepage

Set rs2 = Server.CreateObject("ADODB.Recordset")
sSQL = "SELECT * FROM TABLE"
rs2.Open sSQL, my_Conn, 3
for each fld in rs2.fields
iFieldCount = iFieldCount + 1
if iFieldCount <> 1 then
response.write rs2(fld.name)
end if
response.write "</font></td>"
next
rs2.close
set rs2 = nothing


Go to Top of Page

redbrad0
Advanced Member

USA
3725 Posts

Posted - 08 November 2001 :  11:02:29  Show Profile  Visit redbrad0's Homepage  Send redbrad0 an AOL message
thanks richard, but i even put Server.ScriptTimeout = 9999 in the top and the script still times out. I know its not the database cause i can view small tables, i think its just that this one has so much data in it.

Brad
Web Hosting with SQL Server @ $24.95 per month
Snitz Mod Archive

Go to Top of Page

Da_Stimulator
DEV Team Forum Moderator

USA
3373 Posts

Posted - 08 November 2001 :  11:08:10  Show Profile  Send Da_Stimulator an AOL message  Send Da_Stimulator a Yahoo! Message
richard!? you mean Huw!

Try this brad


iFieldCount = 0
Set rs2 = Server.CreateObject("ADODB.Recordset")
sSQL = "SELECT * FROM TABLE"
rs2.Open sSQL, my_Conn, 3
for each fld in rs2.fields
iFieldCount = iFieldCount + 1
if iFieldCount <> 0 then
response.write rs2(fld.name)
end if
response.write "</font></td>"
next
rs2.close
set rs2 = nothing


---------------
-Da_Stimulator
Stims Snitz Test area - Running 3.3.03, 4 beta, and Huw's modified code
Need a Mod? Check out the Mod Resource
Go to Top of Page

Da_Stimulator
DEV Team Forum Moderator

USA
3373 Posts

Posted - 08 November 2001 :  11:15:35  Show Profile  Send Da_Stimulator an AOL message  Send Da_Stimulator a Yahoo! Message
to get detailed information on each field check out this page

http://www.aspemporium.com/aspEmporium/examples/db_info.asp

I dug through my IE history to find that :P

---------------
-Da_Stimulator
Stims Snitz Test area - Running 3.3.03, 4 beta, and Huw's modified code
Need a Mod? Check out the Mod Resource
Go to Top of Page

redbrad0
Advanced Member

USA
3725 Posts

Posted - 08 November 2001 :  11:18:20  Show Profile  Visit redbrad0's Homepage  Send redbrad0 an AOL message
lol yea i mean huwr (SORRY MAN),

Stim, i tried yours and still got the timeout error message. I guess I will just have to wait till I get to where I can log onto Enterprise Manager to be able to view the table names.

I also sent ya an email stim about freeaspcode.net

Brad
Web Hosting with SQL Server @ $24.95 per month
Snitz Mod Archive

Go to Top of Page

mios
Junior Member

United Kingdom
101 Posts

Posted - 09 November 2001 :  10:00:13  Show Profile  Send mios an ICQ Message
Try this, similar to everyone else, but I don't bother getting the whole recordset back, just an empty one ( WHERE 1 = 2), but it still contains the field collection.

If this dosn't work you could try using ADOX

set ObjRs = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT * FROM TABLE WHERE 1 = 2"
ObjRs.Open sSQL
for each fld in ObjRs.fields
response.write rs2(fld.name) & "<br>"
next
objRs.close
set objRs = nothing

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 1.41 seconds. Powered By: Snitz Forums 2000 Version 3.4.07