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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Exporting Data from SQL 2000

Status
Not open for further replies.

redcare

Technical User
May 20, 2001
32
0
0
GB
Hi

Please help a novice with SQL 2000.
Iam trying to export data into a spreadsheet from my browser window.
The code I have got only allows me to output certain fields.
Is there a way to dynamically input the fields I want to export when I click on the button.e.g by bringing up an input window.
I am using the following code.
==============================
<%
Dim oRS
' Script generates CSV file for procurement scorecards
Response.Buffer = TRUE
Response.ContentType = &quot;application/vnd.ms-excel&quot;
'Write column headings
response.write &quot;Server Name&quot; & vbTab & &quot;Site&quot; & vbTab & &quot;Serial_Number&quot; & vbCrLf

'on error resume next
Set oRS = objConn.Execute(&quot;select Name_of_server,Site_Code,Serial_Number from Products&quot;) ' select statement for export
if err <> 0 Then response.write err.description :response.end
Do Until oRS.EOF
'Write out the fields seperated by tabs
response.write oRS(&quot;Name_of_server&quot;) & vbTab & oRS(&quot;Site_Code&quot;) & vbTab & oRS(&quot;Serial_Number&quot;) & vbCrLf
oRS.MoveNext
Loop
oRS.Close(): Set oRS = Nothing
objConn.close: set objConn = nothing
%>
 
I think you would be better off posting this in the ASP forum as the question relates to the app rather than anything to do with the SQL backend.

--James
 
Oops posted to the wrong forum Sorry about that.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top