There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
acer blue screen boot bsod computer connection crash css dell display driver drivers email error ethernet excel firefox firefox 3 game hard drive hardware internet internet explorer itunes laptop linux malware monitor network networking outlook outlook 2003 outlook express partition password printer problem problems ram router slow sound trojan usb video virus vista windows windows xp wireless
Web Design & Development
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Internet & Networking > Web Design & Development >
Creating Export to CSV Link on Website


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

Closed Thread
 
Thread Tools
smooth's Avatar
Distinguished Member with 3,516 posts.
 
Join Date: Sep 2005
Location: NC, USA
Experience: Learning everyday :)
22-Oct-2007, 08:53 AM #1
Creating Export to CSV Link on Website
Hey everybody

I have a link on my page that I want to use as a way of exporting my data in a SQL database to a CSV file. Such as when a user clicks the link, it brings up a save dialog for them to save it on their machine.

Here is a string of code I have:

Code:
If Request.QueryString("mode") = "exportleads" then
	Set rsUserAdmin = Server.CreateObject("ADODB.Recordset")
	strSQL = "bcp leads OUT leads.csv /c /t"
	rsUserAdmin.Open strSQL, conn
	Set rsUserAdmin = Nothing
	Set conn = Nothing
End If
This is giving me an error:

Quote:
Microsoft OLE DB Provider for SQL Server error '80040e14'

Cannot use the OUTPUT option when passing a constant to a stored procedure.

/admin/admin.asp, line 78
I also tried this:

Code:
If Request.QueryString("mode") = "exportleads" then
	Set rsUserAdmin = Server.CreateObject("ADODB.Recordset")
	strSQL = "SELECT * INTO OUTFILE leads.csv" & _
			  "fields terminated by '\t'" & _
			  "lines terminated by '\n'" & _
			  "FROM leads"
	rsUserAdmin.Open strSQL, conn
	Set rsUserAdmin = Nothing
	Set conn = Nothing
End If
But got the error:

Quote:
Microsoft OLE DB Provider for SQL Server error '80040e14'

Incorrect syntax near 'leads'.

/admin/admin.asp, line 81
I'm not sure which way to go with this. Any help would be appreciated
__________________

Meet Your Fellow TSG Members :: Find Out What CWLMST Means :: NCAA Football :: NCAA Basketball


Looking forward to meeting you up in heaven angel

I don't care how bad I feel, when I go to work I make sure I give it my all! Never any less than 12%...

47.5% of all statistics are made up right on the spot

When something is done in ignorance, then its always best to admit that you have no excuse, fix the problem, put it behind you, and move on - valley
Closed Thread

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who help people like you solve computer problems. See our Welcome Guide to get started.



Thread Tools


You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 03:52 PM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.