Use Array To Hold Or Refer To Recordsets?
I want to use an array to either refer to a recordset or hold the recordset. For example, I have this:
dim rows(5)
rows(0)= rs_manager_0.recordcount
rows(1)=rs_manager_1.recordcount
rows(2)=rs_manager_2.recordcount
rows(3)=rs_manager_3.recordcount
rows(4)=rs_manager_4.recordcount
Can I change it to this:
recordset_names(5)
recordset_names(0)=rs_manager_0
recordset_names(1)=rs_manager_1
recordset_names(2)=rs_manager_2
recordset_names(3)=rs_manager_3
recordset_names(4)=rs_manager_4
for i = 0 to ubound(recordset_names)response.write (recordset_names(i).recordcount)next
The errors is: Object doesn't support this property or method: 'recordcount'
And if I put quotes in the array dim :
recordset_names(0)="rs_manager_0"
The error is: Object required: 'rs_manager_0'
Its not that I'm too lazy to write out the 4 recordset names each time. Th eproblem is that the number of recorsets is variable and there are a lot of tehm , hence I want to refer to the with some simple looping script.
View Replies
ADVERTISEMENT
How do I refer to another asp page from within the exisitng page? ASP1.asp has all the database connections. ASP2.asp need to refer to ASP1.asp for the database connections.
View Replies
View Related
I have multiple websites on single IIS. I have a function (in a seperate aspx.vb file) that I want to use for all the default pages on these sites. How do I 'call' this function' from the aspx files without copying the files into each 'bin' folders? what is the syntax for the code.
View Replies
View Related
I'm attempting to move my database to my site so I can introduce some ASP and ADO. My database is now located in a directory named 'database' which is at the same level as wwwroot.
Could someone please tell me how I change the following line in my Include.asp file to compensate for this? Is there a system variable I shouldcan use?
"Data Source=C:/Inetpub/database/Database1.mdb"
View Replies
View Related
I am new to ASP and I want to use a query which links one record in a table to another record in the same table to display a list of values. The query lists the names of all managers (the managers staff no is held in the reports_to field of an employee)
Set rs=Server.CreateObject("ADODB.Recordset")
rs.Open "SELECT DISTINCT p2.Surname + ', ' + p2.[First name] AS Expr1
FROM People p1 INNER JOIN People p2 ON p1.reports_to = p2.[Staff no] WHERE (p1.[Staff no] IS NOT NULL)",con,3,3
while not rs.EOF
%>
<option value="<%=rs("p2.surname")%></option>
<%
rs.MoveNext
wend
rs.Close
However it doesn't like the alias (p2). Is it possible to return a list from this type of query?
View Replies
View Related
I can extract var from db OK for one page but I need to store var to compare about 5 pages later. I have tried dim but only works on second page. I do not close the record set. I suspect I need to declare var global but how and where?
View Replies
View Related
i have a dynamic drop list, i need to hold the value if the seesion matches the current item, but its not quite working.
Code:
<select name="ByUser" style="width=150px">
<option value="0">Return All</option>
<% rs.Open sqlA, conn
do until rs.EOF
%>
<option value="<%= rs("R_ID") %>" <% If rs("R_ID") = Session("ByUser") Then Response.Write("selected")%>><%= rs("R_Name") %></option>
<%
rs.MoveNext
loop
rs.close
%>
</select>
View Replies
View Related
Is there a limit to the length of the url? Is it browser dependent?
View Replies
View Related
We have a page that loads a long list of things. Each row has an onclick where you can open a window for more information. When you do that the parent page refreshes to the top of the page....so if you were near the bottom, you would have to scroll back down to get back to where you were. I would like the parent page to hold its position when the child opens.
View Replies
View Related
You may or may not be aware of $data = <STDIN>; in Perl which basically takes all the data posted from a HTML form and puts it in to one string variable so that you can manipulate it. What's the equivalent/how would you do this in ASP?
View Replies
View Related
i have managed to get my paypal ipn script to login my webhost to sandbox, however i have had to do this via httppost.
now my problem is, the script moves on, when still loggin in how can i get my script to wait a moment, chill and then proceed as normal like it would if i was live.
View Replies
View Related
im building a page which has a few while loops. this means that im inevitably going to end up with about 20 recordsets on the page. will this slow the page down at all? its quite a lot of hits to the database/server. the results the recordsets will be returning wont be that big though.
View Replies
View Related
My ASP code creates an ADO recordset object on the server.
Later on the same page, I have a javascript code snippet that I use to
dynamically populate a drop-down box based on choices made in another
drop-down box. Can this javascript (or a server-side equivalent)
View Replies
View Related
I dump the entire recordset into an array:
If not rs.EOF Then
aEmp = rs.GetRows()
Contents of the array are in this order:
EmpID,EmpName,Indent,Sub_ID,Lft,Rgt,MgrID, LastName
This query sort on the basis of Lft and Rgt columns.
The name of the array is: aEmp.
My question here is how can I get only the LastName from the aEmp array into another array so that I can sort the names alphabetically and then display the employees in the alphabetical order.
Or is there is another way I could this by using the same array while keeping the lft and rgt sort of the query? If I sort based at the SQL query level, I can see the names sorted by the lft, rgt and lastname, but since the lastname is at the end of the sort list - it does not appear alphabetically.
View Replies
View Related
In working with arrays, I have found that I am unable to dimension and array
with a variable that has an integer value but I can redimension one this
way. I haven't see any information that tells me if this is a requirement,
although it appears to be because I get an error if I try it.
Ex.
Dim b
b = 10
Dim a(b) ' this errors out but
Dim a() ' this
Redim a(b) ' works
Code:
View Replies
View Related
Is there a way of using multiple recordsets with the same connection?
My recordset at the moment inserts data into the database, and i want to have a drop down box with data already within the database, as well as the insert recordset, is there a way of doing this?
View Replies
View Related
Am having trouble opening multiple recordsets - keep getting the er:
Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC Microsoft Access Driver] Could not use '(unknown)'; file already in use.
/eft/postflight4.asp, line 146
Have checked the permissions and the user has full access.
Code:
View Replies
View Related
How do I create a recordset from another?
e.g.
sSQL1="SELECT * FROM ThisTable"
rs1.open sSQL1,conn
sSQL2="Select * from (rs1?) WHERE name='fred' "
rs2.open sSQL2,conn
View Replies
View Related
I create a page which will show me all the Regions from the table "RegionTable" where I have no information (empty fields) in on of the fields RegionDescription or RegionRank.
It is to make my content managing easier. I do not want to see those records which contain all the necessary info (region description and rank).
I tried the following code, but it does not work
qry = "SELECT * FROM RegionTable WHERE RegionDescription="" AND RegionRank="" "
error message is:
([Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1)
View Replies
View Related
Is there a performance advantage to parsing thru a recordset verus using an array?
I'm currently trying to populate a listbox by returning data from my database, then either parsing thru the recordset until I reach the EOF, or putting the data into an array.
View Replies
View Related
I have never sorted a recordset - using rs.Sort - i have no problem sorting it in SQL.
All the tutorials i get say that i have to use a client cursor location, so this is my code:
View Replies
View Related
Let's say you have pages 1 | 2 | 3 | 4 | 5 and you're on page 3. How do you make the code so that 3 will be without url?
View Replies
View Related
Assuming I had a recordset set up like this:
Set rs = Server.CreateObject("ADODB.Recordset")
is it enough to close out the code with
set rs=nothing
or is there a benefit to
rs.close
set rs=nothing ?
View Replies
View Related
im building a site for a clinic. they want to have a calendar which displays the times for each day that are available for appointments.
at the moment i have a calendar on my page. i want to display the correct times for each day. should i use one big recordset that gets all the times/dates from the db or cycle through each day and create a recordset for each day that there are times available (some days the clinic wont be open)?
if i go with the latter option, i could potentially have 30 recordsets open. is there a fast way to execute recordsets.
View Replies
View Related
I have an array of items and for each item I need to find sizes and and for each size I need to find colors The array of items comes from the previous page. Code:
View Replies
View Related
I have a table that is just dumping an entire database data. I would like to have the values of the columns re-sort the data. Not the column heads for the data displayed under the column head varies.
For example, one column, Components, displays 80 components types and another column, Category, displays 40 categories types. When a visitor clicks on one of the component values, it should then display only that data. I've done this before but, it has been a very long time. I remember creating a link surrounding the recordset in my table but what was written.
View Replies
View Related
I have 2 recordsets. One contains all customer info data, the other recordset contains 1 field of customer id's.
How do I create a recordset that contains all customer information (from the 1st recordset)for only the customers in the customer id recordset (2nd recordset)?
View Replies
View Related
I have two different query in my ASP page:
- the first is the list of all my users:
"SELECT DISTINCT lastname, id FROM table1"
- the second is the list of users that join a meeting:
"SELECT DISTINCT lastname, id FROM table1, table2 WHERE table2.codeMeeting = " & Request("code") & " AND table1.id = table2.id"
I want to show all the users in a table (with a FOR loop), with a checkbox that is checked if the users join the meeting (= if users is in the 2° recordset)
How can I do?
View Replies
View Related
I need the IF statement to check 2 recordsets.
If the first recordset has data within then write this to the asp page, If not and the second recordset has data in, then write this to the asp page, then finally if neither of the recordests contain data and are NULL to write 'No Records'
View Replies
View Related
I realize that sometimes you can use recordsets that were never opened (like when you're adding a record to a db) and I realize that you cannot close a recordset such as this.
But for the ones that ARE open, should they be closed first and then set to nothing?
Also,I'm trying to create code that checks if a recordset is open. If so, I wnat to close it. How would I do that?
View Replies
View Related
Is it possible to INNER JOIN two recordsets in ASP?I don't mean the normal JOIN you would use with two tables, but actually join the recordsets in ASP?
View Replies
View Related
Is it possible to move to all the open RS and connections? I open different recordsets on my page and in the end I need to close them and close connection. Problem is I need a function to do that to have it on every page.
Is it possible to travel through all open recordsets like it is possible to travel through all the querystrings and form data?
View Replies
View Related
What is the best way to produce these? Is there a SQL statement thatselects, say, records 30-40 from the results?
View Replies
View Related