have a search.asp page with results.asp page drawing data from an SQL db,
problem is the user has to type the whole field value into the search box to
retrieve the value on results.asp, what I need is to type in just a few
characters e.g. at the moment to search for all pickups at Heathrow Terminal
1 the user has to type in
Heathrow Terminal 1
When really I just want them to type in
Heathrow or even Heath etc.
Query below
SELECT * FROM booking_form WHERE AirportStation LIKE '" +
Replace(BookingForm__varAirportStation, "'", "''") + "'
I made a little search query asp page connected to a database everything works. Just I added a if then statement but...I don't think I am doing it correctly... This is my code:
<% If strSearch = "true" then %> <% Response.Write "Search Result" %> <% Else %> <% Response.Write "We are sorry your search could not be found" %> <% End If %>
I have been working through a search distance by postcode tutorial. the script works fine when used with an access database however i need to use it with mySql but its throwing up this error.
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[MySQL][ODBC 3.51 Driver][mysqld-4.1.11-standard]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 ') AND Selectmake = 'Audi'' at line 1
the code its refering to is this:
Dim rsResults Dim rsResults_numRows
Set rsResults = Server.CreateObject("ADODB.Recordset") rsResults.ActiveConnection = MM_conNatCarSearch_STRING rsResults.Source = "SELECT * FROM Adverts WHERE Trim(Left(yrPostcode, 4)) IN (" & yrpostcode & ") AND Selectmake = '"& _ Replace(rsResults__MMColParam, "'", "''") & "'"
I have an Access db with a table which contains some fields. I have also created a page in which I have created a form with textfields, listmenus, radio buttons and checkboxes. I would like to pass the values from the form in another asp page in which I will retrieve the records according to the selections made in the form.
If I select all the form fields it works great but if I want to select only two or one field I get nothing. That is because in the SELECT code I have used AND...AND.... Is it possible with if statements to avoid this problem?
i'm trying to make a form that will pull details from a record that is found with (asset Number) but comes up with this error: 2342 "A RunSQL action requires an argument consisting of an SQL Statement"
Dim SQL As String SQL = "SELECT *" SQL = SQL + " FROM Computer" SQL = SQL + " WHERE (((Computer.Asset)=" & TxtAsset.Value & "));" DoCmd.RunSQL SQL
I'm creating a database search page and the table I want to search has fields linked to other tables in the database. For example, the job table has a number of fields, 2 of which are area and job type which are tables in the database. My search page has option for searching by job title, job type and job area (via dynamic drop-down).
Do I need to create a recordset for each referenced for the dynamic drop-downs to work?
I have an Access database that I created a query in. The query brings fields from related tables and prompts users to perform a search based on 3 criterias.
NOTE: the prompts can be bypassed by just leaving it blank and selecting OK. So in other words, the user does not need to fill in each prompt for the search to work, it just give them a more narrowed down search if they fill more in...
Now for the ASP part... I want to create an ASP page where the use selects from 3 drop downs. These drop downs are named the same as the field names in my query. How do I get this to work??
I have a field storing Multiple information in a string (ex: <Select name="MUnionCode" Multiple>
This allows the user to select multiple options. These options are stored in an spl database as: option1, option2, option3 etc..
Now, if I want to search that field how can I have it check to see if any of those options are within that string..? Instead of just checking the first option...?
here's what i want to do. from an asp page, perform a search on a table in access. i have used sql code in the asp page itself, but i'd rather execute a query in access. i have success in running any query (basic SELECT, SELECT with conditions _other_ than LIKE, etc..) for some reason, when i execute the query below from the asp page, i get no results.
the search.asp page just has a text box in a form that submits the srchBOX field to the results.asp page.
here's the asp code from the results.asp page: Code:
My code retrieves a username and a password from a form. Then this information is compared to some usernames and passwords that are stored in a database. The important thing here is that the comparison must be case sensitive meaning that "passWord" is not the same thing as "password"
I have this code, working fine in access 2003
SQL = "SELECT * FROM users WHERE StrComp(username_column,'" & entered_username_in_form & "',0) = 0 AND StrComp(password_column,'" & entered_password_in_form & "',0) = 0"
but get the following error when I run it against my sql 2005 database.
[Microsoft][SQL Native Client][SQL Server]'StrComp' is not a recognized built-in function name.
I don't know the corresponding t-sql for the query.
i get the ref url that come to my site and i want to convert it to find out what was the query in (google or other searcher sites)
foe example : if someone goes to google and search some text and my site was in his resaults and he click on it , in my site i see his link ref like http://www.google.co.il/search?hl=i...91-Google&meta=
i want to know (in asp and save it to DB) what was the word or words that the user write in search engine.
I am running a querry on an access database and have set the number of records/page displayed at 20. if there are more than 20 records returned, then 1st page will show the first 20, the next page will show next 20 and so on....
The trouble:
the count of total records displayed is correct and the first page is displayed correctly. But when i click on *Next* to go to the next page, all the records of the database get displayed (not the 2nd page of records from the query).
In Access you use "*" + [passed variable] + "*", + can be replaced with & Calling a parameterized query in Access requires % be used in place of *, however, all that I have read show dynamic SQL passed to Access:
WHERE [some column] LIKE '" & ASPvar & "' % ORDER BY ...
However, my call is similar to:
conn.qMyLookup strVar, rs
If I modify the query in Access to:
"%" & [passed variable] & "%"
I get all records. If I only put it at the end, as suggested, I only get matches at the end, not throughout the column. Code:
I am trying to create a parametric search within a table (in the column headings). My first page (search.asp) allows you to choose parameters from a dropdown box, such as package and volts. You click "search" and it reads the Access dbase to yield the results.
The results page (results.asp) displays the information based on the parameters. Under the package column heading, I have the same drop down box, and I am able to once again choose the package I want and the table will refresh. Code:
I can't write the sum of a certain colum in a table of a db.
<% sql_Sum_Tax="SELECT SUM(vtax) AS sql_Sum_Tax_RS_Var FROM orderstats WHERE vcompletedate BETWEEN "& startDate &" AND "& endDate & ";" Set sql_Sum_Tax_RS = Server.CreateObject("ADODB.Recordset") sql_Sum_Tax_RS.Open sql_Sum_Tax, conn1 %>
I have an Access database of literature that I want to search using an ASP page using multiple search criteria (author, title, year, discipline,etc). I'm using a form to collect the criteria from the user and then sending it to an ASP page. I'm creating the SQL statement using variables that pick up values passed from the form.
Code:
strSQL = "SELECT * FROM Literature WHERE " & _ "(Author Like '%" & mauthor & "%') AND " & _ "(Title Like '%" & mtitle & "%') AND " & _ "(Journal Like '%" & mjournal & "%') AND "& _ "(ArticleBook Like '%" & mBookOption & "%') AND " & _ "(Year Like '%" & myear & "%') " & _ "ORDER BY Title ASC;"
This would probably work if I used "OR" in my SQL, but I want to be able to use "AND." My problem is that I'm not getting records that have null values in some of these fields.
Ive been working with queries through asp on a mdb file. The biggest problem i have is that when i query a certian column that had embedded hyperlinks in it, the query also returns the value of the hyperlink. Is there any way not to have to remove the hyperlinks in the database and not have them show up on queries? Code:
I am learning ASP from the Wrox Begining E-Commerce book, which uses Visual Basic to create a DLL and it also uses MTS as well. I have been trying to find hosting not realising the problem with registering custom dll's on server and know realise that this isn't the best way to do this. I wanted to know if there was anything i could do to change this. I have read a little bit about the Global.isa file but am not sure about this. Could i just transfer all the code into the global.isa and then use it like this. My website access a sql database and uses a mts pipeline for order processing. I don't have enough experience of ASP to re-write this code and am not sure of what to do. I have tried searching the web but am not really finding any solutions that I understand.
I am trying to have the SQL query select from a table where two conditions exist. The line:
Code:
SQL = "SELECT * FROM CompsIn WHERE Out = -1 "
Works, but I want to have it also select from compsin where UserGroup = Session("UserGroup") Until I connect the login and the CompsOut pages,adding Where UserGroup='CSU836' will work just fine.
and say 4569 belongs to joseph i want to tell what josephs rank is looking at the values his rank is 1 if 124 belongs to justin then his rank is 4 the more the points the higher the rank can someone tell me how my sql query will be
Is there a way to query for a users IP address with classic ASP/VBScript?
I'm building a local app that will feature a simple logging system. I'd like to have any user be able to update a form and when submitted, the page can look up the users IP and know that this update came from "Jeff's Workstation", for example.
There would only be 40 or so users, each of whom has a static IP that I could use to perform the lookup.
Can anyone point me the right direction, or perhaps suggest a better way to approach this problem?
I have a column in a db which has valus separated by , e.g. 1,4,12,5 I want to be able to search the db and return info where a variable has similar values to the ones in the column. So they don't all need to be the same. They could be 18,4,9,199 and the common no. 4 would be matched and info extracted. I have tried using % in my SQL but it doen't work 100%. (e.g select * from table where column_data LIKE '%"variable"')
I need help with a SQL statement using AND OR properly. Say I want to list all records which are of the type page, state active but belong to different groups. My statement to list from one group might look like this:
Select * From Objects Where rs.Type=0 And rs.State=2 and rs.Group=3
Adding an OR clause, how would I list all groups (say 1-5)? Do I have to specify type, state and group 5 times?
I am trying to compare the students current preference to all of the preferences they have already selected. ie: If they select a preference of '1', and they have already selected that preference before, then they get an error. This is the SQL that I have so far:
SQLPreference = "SELECT DISTINCT [tblStudents.Preference] FROM [tblStudents] WHERE (tblStudents.Student = '" & session("Valid") & "') AND (tblStudents.Preference = '" & Request.Form("Preference") & "');"
Now, this works perfectly when they have already selected that preference... They get the proper error. However, the problem is that if the two don't match up, then I get a 'Exception occurred' error. I know why this is happening... Simply because the SQL statement can't find Request.Form("Preference") in the database, and thus is generating an error. Code: