I am trying to construct an If Statement from an URL variable.
Basically if a string in the URL variable, reads, 'Technology, then I want to response.write something. If its anything different, then i would like to response.write something different. The URL = news.asp?type=technology
I have already declared that the lngRecord = Request.QueryString("type") and I have constructed the following If statement off the top of my head, but its not working properly.
I have also been able to access an individual page depending on the URL variable so it's definitely a problem with only my poorly-constructed If statement and nothing else
select contactname,contactnumber,contactnumber1,contactem ail,address,city,state ,zip,type,sqft,0,bedrooms,baths,lotsize,acreage,ga rage,comments,price,0, 0,county from table1 where active='Y'
I need HASPHOTO to equal 1 if hasphoto <> 0 and HASPHOTO=0 when hasphoto=0. Make sense? HASPHOTO usually equals a number, but in this case, I want it to equal a 1 or 0 because I am exporting this to a CSV file. I know how to do everything else, just not this part.
The form post an agent name to the next page it then takes that name and matches it to the database and shows all entries that agent has. my problem is with calling the variable in the query I just cant seem to get the syntax right Code:
I have a SQL DB with a number of tables and queries (views) in.
In front of this is my ASP app I am designing.
When my users log in, their User ID is stored in a session variable.
One of the views determines which User ID can access which records, and obviously then I want to base all my app around this so that a user can only ever be working on data relevant to them.
Is there any way of using a variable in my SQL View outside of DWMX so that once my users log in, the SQL View is automatically filtered based on their User ID in the session variable?
Is there a way of inserting a variable/parameter into SQL so this happens?
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 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 got that right now but i want the variable, console to be placed along with news so when it selects from the db it selects from gcnnews or whatever variable it's on. How do I do that?
I need to assign a value to a variable, but this variable name is dependant upon another variable!! I am including the code below so you can see it, cos if not I am sure you are thinking whattt?? 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: