Alter This Select Statement To Specific Record
cmdTemp.CommandText = "Select * From users"
cmdTemp.CommandType = 1
Set cmdTemp.ActiveConnection = DataConn
rstContacts.Open cmdTemp, , 1, 3
rstContacts.Move CLng(Request("Record"))
i only want this command to display from the users table the details
of the user that has the username (from the database) equal to the username of the person who has just logged in from my login form (uname input box) this code at the moment displays the first record, i dont want that.
View Replies
ADVERTISEMENT
I have a few ASP pages that go out and query a database and return data that meets a requirement. For example I have Department hyperlinks in a Nav bar that select just the records associated with that department. The returned records are placed in a table to be viewed. In that table I have a field hypelinked to a PDF image. 100+ records could be returned.
How could I place a hyperlink, or check box, in one of the fields that would select that specific record and display the data on another ASP Page. What I am trying to get at is when I get the returned set of records, being able to click ONE of them and display that information as well as any associated images connected to that single record.
View Replies
View Related
im a bit of a rookie and i couldnt find anything using search,how can i have a statement which selects only the records which contain data.
Code:
sSQL = "SELECT * FROM VIEW_COLLECTION " &_
"WHERE (BusinessID = 20) AND (Parentid = " & objRScats("CategoryID") & ") " &_"ORDER BY CollectionName"
Thats what i currently have. This is for the page navigation - and i dont want a those collections that do not have any data to be diaplyed - but i do not want to delete these records altogether just yet.
View Replies
View Related
i have a shopping cart that gets its information from the cookie.
is it possible to add a remove item to my shopping cart so that i can delete a specific item from my cart?
View Replies
View Related
I am developing a budget app using asp, access and Dreamweaver. What I need is a way to loop so that I can display months starting with a designated begininng fiscal month. In this case it is July. I need to display 6 months in a row starting with July and in a separate table below I need to display the rest of the months in the fiscal year Jan - Jun. Like so....
7 8 9 10 11 12
1 2 3 4 5 6
I think it will take two separate while loops.
View Replies
View Related
I have a server using a webapp built on classic ASP, and I use a library that creates/manipulates a datagrid-style display on the page.
I am displaying a large chart with sufficient data that it will likely be paged, and there are several columns that are toggles (using checkboxes for these, with the entire column having the same checkbox NAME, but different values depending on the record).
I have a piece of script that for loops through the records present on the page (determined by a collection of hidden form values), and then I need to check if the collection formed by a given column contains that value, something like the following (pseudo-code):
View Replies
View Related
This is my problem. I am adding to a table called Case the details of a case.Now the primary key for that, is an ID which is generated automatically by the DB.
I also have two relational tables related to the Case table, so I need to add records there. For this I need the case_id
just generated by the database when I added the case. What would be a good way to get that case_id?
I also need the case_id, because the interface to add info to the case table is spread across two tables, so when the user goes to the first page and "saves and continues" I want to store the case_id for the second interface page.If I select all the records from case, would I select the newest record first or would it be the last?
View Replies
View Related
is there a way to select a row from a record set?
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
Why when I add the AND statement, this query doesn´t work? Am I wrong with my syntaxis?
SELECT ID, month, theyear FROM myDB where theyear = 2008 AND month = 1
If I only leave theyear or month it works. If I put AND it doesn´t.
View Replies
View Related
Ok here is what I'm trying to do. I want to grab a random record from a specific table. This is how I am doing it now:
x = 0
Set rs = Conn.Execute("SELECT Count(*) as total FROM [user] WHERE active = '1'")
If rs.EOF <> True then
total = rs("total")
End if
Randomize timer
randnum1 = int(rnd * total)
If randnum1 = 0 then
randnum1 = 1
End if
rs.close
set rs = nothing
Set rs = Conn.Execute("SELECT * FROM [user] WHERE id = '" & randnum1 & "' ")
Now that would work fine, BUT the id is a autonumber int of 1.
Now look at this example. Let's say I have 50 records, so I have the ID values of 1 through 50. Now I delete record number 46. So now my count goes up to 49. So the random number will pull up ANY number between 1 and 49, so if it pulls up 46 then BAAAM record can not be found.
There has to be an easier/more efficient way of getting a random record. I don't plan on deleting any records, but I just don't feel this is the best way of doing this.
View Replies
View Related
Find below the error I get when the code below is executed
Code:
splitval = split(request.form("start")," ")
dep = splitval(0)
splitval1 = split(request.form("end")," ")
dep1 = splitval1(0)
"SELECT * FROM Info WHERE requestDate BETWEEN dep AND dep1 "
error:
No value given for one or more required parameters.
Can someone help correct the error in the code.
View Replies
View Related
i need select statements that counts records from my access database where the time difference is worked out between two fields (datein;dateclosed). Less than 24 hours, >3 days, >5 days, >10 days, >15 days, >30 days, >60 days, >90 days
i am not sure how to construct the statement. If i can just get one, i can hopefully do the rest.
i have now:
strSQL2 = "SELECT Count(*) As Total FROM ptqr WHERE DateDiff('d','" & datein_now & "','" & dateclosed &"')< 1 "
but i get an error:
Microsoft OLE DB Provider for ODBC Drivers error '80040e07'
[Microsoft][ODBC Microsoft Access 97 Driver] Data type mismatch in criteria expression.
/asp/ford_tsb/pscs/reports/charts/Chart5.asp, line 40
View Replies
View Related
I have a sql statement that contains many fields. I am having problems with the way I am writing the sql statement. Here is an example:Code:
filePath = server.MapPath("directory/dbName.mdb")
Set conn = Sever.CreateObject("ADPDB./Connection")
conn.Provider = "Microsoft.Jet.OLEDB.4.0"
conn.Open filePath
mysql = "SELECT field1,
field2,
field3,
I get an error at the comma on the line "SELECT field1,
What is the proper syntax for line continuation?
View Replies
View Related