SELECT Statement Pulls Field Names - How To Avoid?
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? Code:
View Replies
ADVERTISEMENT
I want to run a query from input. There are 4 input that are optional for user. So what is the simple and fastest way to do it instead of too many if statement and repeating query. What I've done now semilar like this
id = Request.Form("id")
tittle = Request.Form("tittle")
case = Request.Form("case")
desc = Request.Form("desc")
If id <> "" then
Run Query
Else
If tittle <> "" Then.......i have to insert more if statement..how can I make it more easier?
View Replies
View Related
i'm new here and i'd like to ask if there's someone who knows how to compare date() function and date from database with date/time type inside select statement so i don't have to do if..then..else
View Replies
View Related
I have built input fields inside a while not.eof loop
and the name is built from using <%="name"&i%> and the value is a product_id
from the database.the i is then incremented in the loop, resulting in <input name="name1, <input name="name2
and so on. this works no probs, however i haven't got a clue on how to collect this dynaimcally named
input field when it arrives at the form action address page.
I was thinking some kind of for loop but am not sure, and again am not sure where to put the <%="name"&i%> bit
to count or grab the input fields info.
i.e newname= REquest.Form(<%="name"&i%>)
View Replies
View Related
I have a "csv file" as a database.
The 1st row contains the field names:
Orion.Accounts.AccountName,Orion.Accounts.Address1
the code I use normally works:
<%=rs("Orion.Accounts.AccountName")%>
Although in this case is doesn't because the fieldnames contain full stops.
how to modify this line:
<%=rs("Orion.Accounts.AccountName")%>
View Replies
View Related
Does anyone have a definitive list of keywords to avoid or prohibit as field names for the tables for an ASP driven program that communicates with a SQL database?
I have a website that allows customers to define tables online and I keep hitting the field names I need to prohibit - "Function" is the latest one. I'd like to just compare the users field names with a list and end this problem for good! Also any VBScript words too?
View Replies
View Related
When using RS.getRows how do I go about getting the field names from the database as well?
View Replies
View Related
I am trying to display only certain columns from a table and this is a code that I am using but it is not diplaying anything, can anyone tell me where my code is wrong
<%FOR EACH field IN rstSite1.FIELDS
if field.name ="EmpName" then
RESPONSE.WRITE("<TH ALIGN='LEFT' BGCOLOR='#B0C4DE'>"& FIELD.NAME & "</TH>")
end if
NEXT%>
View Replies
View Related
I am designing a shopping site, in the picture the #1 section is a check box behind product name that customer can select that product to buy in #2 section the customer can set quantity of the selected product ok now codes this is the code which I have used to pull out produts and categoris from database and show them on the page Code:
View Replies
View Related
I tried posting this a minute ago but timed out, so sorry if this is posted twice.
I want to make an IF statement in ASP using VBscript that will run if a checkbox in a form is checked (and won't otherwise). How do i refer to the form field (checkbox) in the IF statement to do this?
View Replies
View Related
Is it valid to get information from a request.form assign that to a value then use that value to get other content on the requested page.
I return a large rs with multiple feild names. I can't use a static feild def because they would overwrite each other on the loop, SO i create dynamic field names then pass the id back to the next page via javascript. I then use that id to add to the feild name to make sure I get the right feild.
Id = Request.Form("Id")
SQL STUFF
CheckedID=Request.Form("Name_"&Id)
View Replies
View Related
I have been provided with a DSN, user name and password for one of my
clients sites.
I'm not an ASP developer and need to view all the contents of this database.
I usually work in PHP but only have ASP available on this server.
I want to open the database and simply output all the contents into a HTML
page.
View Replies
View Related
I have an Access database with 58 fields in one table. I wrote many
of the field names so that they were descriptive so that others could
figure it out in the future. As an example, one field name is called
MissingPart14990aDescribe.
Should I be worried about the length of the field name? I'm expecting
about 20,000 records a year to be entered into the database. So, five
years from now, which would be about 100,000 records, will the
query.asp for a list of records be slow due to field name size? BTW,
the query.asp would just show a list of the last 3 months worth of
records and only a snapshot of about 6 of the 58 fields.
View Replies
View Related
how do you select all the fields in a table that do not contain any data?? I have tried the below and it wont work??
View Replies
View Related
I am trying to display a feild from the table. But there is a Type Mismatch error that I am getting. Can anyone please take a look at my code to see what could be wrong.
The error that i am getting is:
Microsoft VBScript runtime error '800a000d'
Type mismatch
/jobapplicationnew.asp, line 1285
Line 1285 is highlighted.
Code:
View Replies
View Related
following is my select statment code, works partially fine but the city search is not working.. i.e it gives me list of all hotels that start with the given words whereas it should give me hotels in the given city only. pls help me out. thanks
sSQL = "SELECT * " _
& "FROM [hotel] " _
& "WHERE hotel_name LIKE '%" & Replace(hotel_name, "'", "''") & "%' " _
& "OR hotel_name_e LIKE '%" & Replace(hotel_name, "'", "''") & "%' " _
& "and city = '"&city&"';"
View Replies
View Related
the select statement as per the following relationships:
drop1id has 1 to 9 records.
drop2id has 1 to 65 records - FK drop1id will be 1 to 9
drop3id has 1 to 356 records - FK drop2id will be 1 to 65
drop4id has 1 to 356 records - FK drop3id will be 1 to 356.
I am not sure how to retreive the records based on their relationships.
View Replies
View Related
does anyone know if its possible to look through a field in a database and see if it contains certain keywords?
i am using a database with a field called MainIssue and i want to see if it contains keywords and if it does, to display the contents. is there a command which would do the same thing as:
select * from maintable where field contains "keywords"
View Replies
View Related
I am having problems with a select statement in asp with an access database.
I pull First and Last information from my form
First = Comes from form
Last = Comes from form
I have validated that the form information is being pulled this is where my problem lies.
Code:
SQL = "Select Listing where (FirstName =" & First & ") AND (LastName =" & Last & ")"
For some reason I can not pull the information for the database using this. If I take the AND (LastName =" & Last & ") out I can pull some of the information, but I am looking for a specific last name, first name entry.
View Replies
View Related
i have the following tables in my Access database
info1, info2, info3...
all tables have the same columns with the same type of data.
code, description, activated etc.
now i ask the user to enter a code, and then it searches through all the tables for that code. the reason i broke it into smaller tables is there is 10s of thousands of records.
it should find the record that match with the entered code and then if the user wants to, he can edit the data, the date is then automatically saved into the record as well.
View Replies
View Related
Some of my pages include paging where the variable starts with a certain letter. This worked fine in access but when I try to run it with mysql it says...
Microsoft OLE DB Provider for ODBC Drivers error '80040e37'
[MySQL][ODBC 3.51 Driver][mysqld-4.0.17-nt]You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT username, status FROM users WHERE username Like 'A%' OR
View Replies
View Related
This is really simple but for some reason no recordset is returning. I can't get cat_1 to write. I have run the query against the database in Query Analyser and it runs fine.
Code:
Dim objConn
Set objConn = Server.CreateObject("ADODB.Connection") objConn.ConnectionString = "Driver={SQL Server};Server=nzlakldwhse;Database=Complaints;Uid=elkuser;Pwd=elk;"
objConn.Open
Dim objRS
Dim cat_id, cat_1, cat_2
set objRS = objConn.Execute("select cat_id, cat_1 from complaints.dbo.category a where a.cat_id = '"& request.form("cat_id") &"'")
response.Write(cat_1)
response.End
View Replies
View Related
Code:
[advsearch = "Select * from img_inv where item_num like '%" & item_num &"%' or category = '" & category &"' order by item_num"
I want it to be able to search the db by like item number or exactly equal it a given category list.
View Replies
View Related
How do i get this to work, i have 3 colums forename, surname and groupname and a colum Genre. I want to select any of the 3 first colums for a name, where the Genre colum is X
this is the statment i have
Code:
"select * FROM autos WHERE forename LIKE '" & session("name") & "' OR surname LIKE '" & session("name") & "' OR groupname LIKE '" & session("name") & "' AND genre LIKE '" & session("genre") & "'"
this is what i get :-
select * FROM autos WHERE forename LIKE 'david' OR surname LIKE 'david' OR groupname LIKE 'david' AND genre LIKE 'Football'
giving David and 'session("name") and Football as session("football")
View Replies
View Related
I've inherited a database with NULL values in it. I plan on fixing this problem, but for now I need to get this statement working.
cmd = "SELECT * FROM EmpInfo WHERE Interview <> NULL AND status IS NULL OR status <> 'D'"
I'm trying to pull information from the table that need to conform to two different rules. First, there needs to be a value in the INTERVIEW column.
Second, the column STATUS has to be NULL, there can be no D (for delete) in the record.
I can get it to pull the records following the conditions for STATUS, but not for INTERVIEW. I don't work with NULL values very often, so this one is throwing me for a loop.
How can I write that statement to pull only those records that are not NULL in one column, but NULL in another?
View Replies
View Related
In my company one of the people who works for me has done this:
sqlText = "SELECT products.ProdID, productName, " _
& "productPrice, quantity from products, " _
& "itemsOrdered where " _
& "products.productID = itemsOrdered.productID "_
& "and itemsOrdered.orderID = " & intOrderID
I am just a little unsure what products.ProdID means when later on in the string there is the FROM products?
View Replies
View Related
i give the users the option to choose between a daterange to get data from the database.
For example
(RADIO BUTTON) Last 7 days
(RADIO BUTTON) Last month
(RADIO BUTTON) Custom dates
Got the custom dates part to work, but how do i write my select function to select todays date and then go back seven days / 1 month(30days)?
View Replies
View Related
In a select statement How do i select the last 10 records in a database?
View Replies
View Related
I've got a client who needs some ASP's coded for a Unix server running ChiliSoft, (I had no say in the matter).
I'm banging my head against a wall with the following code:
[VBS]Set objRs = Server.CreateObject("ADODB.Recordset")
Set objRs.ActiveConnection = objConn
objRs.Open "Select * From tblDataBank_Summer Where DatabankID = " & intDatabankID, , adOpenStatic, adLockOptimistic, adCmdTable[/VBS]
I've used this coding elsewhere on other sites with no troubles, but here I keep getting:
ADODB.Recordset.1 error '80004005'
SQLState: 42000
Native Error Code: 1064
[TCX][MyODBC]You have an error in your SQL syntax near 'Select * From tblDataBank_Suummer Where DatabankID = 114 ' at line 1
View Replies
View Related
how to do a select statemtn like below
SELECT * FROM table WHERE ID =" & strID & " AND Users LIKE " & strUserName
View Replies
View Related
im in need of some guidence regarding select statements. is it possible to combine to select statements?reason for asking is i got this in my access mdb i have to queries one to get the specific member for witch i want the sum from and name is used as creteria then the secon queri is the sum it selfe by using grouped and name as creteria that works well but if i want this on a asp page it becomes little dificult.
well i cant see how can be done as i hoping some of u out there do i was thinking of combining the 2 so the first select gets the info then sum as secon select in a combined select statement i dunno if thats possible. or is there a way i could just use a select all from table and a asp function that can sumerize a field and then put that as a response.write?
View Replies
View Related
Currently i am doing 2 select statement of SQL
select xxx into #temp
select xxx from tablA inner join #temp
... condition....
... condition....
and this hit error show that as attachment
anyone know y asp cant work with 2 select statement?
View Replies
View Related
I keep getting an error when i execute the following statement?
SQL = "SELECT * FROM shop WHERE brand,size = '"& brand & "', '" & size & "'"
View Replies
View Related