473,473 Members | 1,491 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

SELECT statement - How to not get column field names?

I do a SELECT * from table command in an ASP page to build a text file
out on our server, but the export is not to allow a field name rows of
records. The first thing I get is a row with all the field names. Why
do these come in if they are not part of the table records? How do I
eliminate this from being produced? Here's the ASP code....
<html>

<head>
<title>Package Tracking Results - Client Feed</title>
</head>

<body>

<%
' define variables
dim oConn ' ADO Connection
dim oRSc ' ADO Recordset - Courier table
dim cSQLstr ' SQL string - Courier table
dim oRSn ' ADO Recordset - NAN table
dim nSQLstr ' SQL string - NAN table
dim objFSO ' FSO Connection
dim objTextFile ' Text File

' set and define FSO connection and text file object location
Set objFSO = CreateObject("Scripting.FileSystemObject")
'Set objTextFile =
objFSO.CreateTextFile(Server.MapPath("textfile.txt "))
'Response.Write (Server.MapPath("textfile.txt") & "<br />")
Set objTextFile = objFSO.OpenTextFile("C:\textfile.txt",2)

' write text to text file
'objTextFile.WriteLine "This text is in the file ""textfile.txt""!"
' SQL strings for Courier and NAN tables
cSQLstr = "SELECT * FROM Courier"

' set and open ADO connection & oRSc recordsets
set oConn=Server.CreateObject("ADODB.connection")
oConn.Open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" &
"c:/Database/QaTracking/QaTracking.mdb" & ";"
set oRSc=Server.CreateObject("ADODB.Recordset")
oRSc.Open cSQLstr, oConn

Response.ContentType = "text/plain"
Dim i, j, tmp
If Not oRSc.EOF Then
For i = 1 To oRSc.Fields.Count
objTextFile.Write oRSc.Fields(i-1).Name
If i < oRSc.Fields.Count Then
objTextFile.Write " "
End If
Next
objTextFile.WriteLine
While Not oRSc.EOF
For i = 1 To oRSc.Fields.Count
If oRSc.Fields(i-1) <"" Then
tmp = oRSc.Fields(i-1)
' If TypeName(tmp) = "String" Then
' objTextFile.Write "" &_
'Replace(oRSc.Fields(i-1),vbCrLf,"") & ""
' Else
objTextFile.Write oRSc.Fields(i-1)
' End If
End If
If i < oRSc.Fields.Count Then
objTextFile.Write " "
End If
Next
objTextFile.WriteLine
oRSc.MoveNext
Wend
End If
objTextFile.Close
Set objTextFile = Nothing
Set objFSO = Nothing
oRSc.Close
Set oRSc = Nothing
oConn.Close
Set oConn = Nothing
%>

</body>
</html>

Jan 24 '07 #1
1 6088
Hi,

If I understand correctly you want to eliminate the first row in the result
text file which contains the field names. In your code you have a loop that
writes those to the text file:
For i = 1 To oRSc.Fields.Count
objTextFile.Write oRSc.Fields(i-1).Name
If i < oRSc.Fields.Count Then
objTextFile.Write " "
End If
Next
objTextFile.WriteLine
Just comment out the section above and it should no longer write the field
names to the output file.

Regards,

Plamen Ratchev
http://www.SQLStudio.com
Jan 24 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Mark | last post by:
Hi - I have set-up security for my users - the security is held in a text field, separated by a comma. If the users a member of groups 1, 5 and 6 - the usergroups field is set to 1,5,6 - to...
5
by: Reestit Mutton | last post by:
Hi, I'm currently learning the ropes with CSS, PHP, MYSQL, Javascript etc... by redesigning my website as a database driven site. Okay, so I'm skilled at perl, data manipulation and data...
17
by: kalamos | last post by:
This statement fails update ded_temp a set a.balance = (select sum(b.ln_amt) from ded_temp b where a.cust_no = b.cust_no and a.ded_type_cd = b.ded_type_cd and a.chk_no = b.chk_no group by...
7
by: CharlesEF | last post by:
Hi All, I have run into another problem that is eating my lunch. Should be simple but I am having one heck of a time. Please look at this SELECT statement: SELECT FROM States WHERE ] =...
3
by: Tcs | last post by:
My backend is DB2 on our AS/400. While I do HAVE DB2 PE for my PC, I haven't loaded it yet. I'm still using MS Access. And no, I don't believe this is an Access question. (But who knows? I...
5
by: freddy | last post by:
I have a select statement like this: string Select = "Select TableofContents, DataOwner, Delegates From NYC"; and it work fine, but if I was to put a space in like this: string Select = "Select...
0
by: Michael Seele | last post by:
hi! i need a list of all primary keys in my database! for this reson i build these sql-statement: /SELECT pg_class.relname AS tableName, pg_constraint.conname AS pkName, pg_constraint.conkey AS...
6
by: jjturon | last post by:
Can anyone help me?? I am trying to pass a Select Query variable to a table using Dlookup and return the value to same select query but to another field. Ex. SalesManID ...
22
by: MP | last post by:
vb6,ado,mdb,win2k i pass the sql string to the .Execute method on the open connection to Table_Name(const) db table fwiw (the connection opened via class wrapper:) msConnString = "Data Source="...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.