what the easiest way is to get the number of records in a recordset, or the number of records returned by my query. I can't get this rs.recordcount thing to work. it just returns -1 all the time. I read on asp101 that it only works when you're using the right cursor type but I tried using the cursor type they said to use and it still doesn't work. I also did the test they gave to check if your record set will allow recordcount()
Code:
If rs.Supports(adBookmark) Or rs.Supports(adApproxPosition) Then
Response.write "will work"
End If
and that works...
So can anyone help me plz!
ps. whithout looping through the records and counting them if possible plz! there must be a shorter way than that.
I have a query that is supposed to return only 1 record, however I recently found that because of an error in the database it can return more than 1. So what I need to do is capture if it is more than 1 record and alert the user to contact the database administrator. How can I get the count of records returned by a recordset? Is there no way besides looping through with a counter variable?
If I want to display the last X number of records in a recordset, how would I do it? Say I have ten records and I want to display them showing the smallest amount first: Code:
i need to put the records i'm getting from my query into a string, can someone tell me how to do this.
i've tried GetString, but thats not what i'm looking for, my query pulls up ID's and i need to put these into a string so i can split them up to be used in another query.
I'm trying to only show 10 records at a time. I have the first 10 records showing. The problem is that when I click the Next button I get an error message: ADODB.Recordset (0x800A0BB9)
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another. Also different people are going to search for different things so there will always be a different amount of records returned each time. I can't figure this out. My code is:
What I want to do is have a recordset with all records in and display a list by title with a tick box next to them, then goto a new page which the recordset is all the records that the user selected on the previous page.
I'm having trouble with the recordset object. I'm trying to use the "RecordCount" aspect of the recordset but it keeps diplaying "-1". How do I get it to show the total count of records?
The problem concerns 2 tables, cart_products and cart_shoppingcart.
Cart_products contains all the product data (eg, prices, product's key name, etc), but most importantly, it contains the quantity of stock (prod_quantity) for each item.
cart_shoppingcart contains all of the user's items in their shoppingcart, including those that are part of an (customer) order; these have the order_number to differentiate from those that aren't in any order (their Order_number is 'no_order', the others have the order number).
Now, what I want to do is this:
For every item in the order (ie, every entry in cart_shoppingcart that matches the username and order number), take the quantity (x) the customer is ordering, then take the quantity of stock remaining (y), then subtract x from y to create the new stock level (z) and update the appropriate record in cart_products with z (all this with SQl preferably).
I was thinking of using a Do while loop, but realised that it wouldn't work as I'd have to use several SQL statements and then I'd run into a problem the minute ASP reads "objrec.movenext".
Last week, my shopping cart was still working well until I began getting the following errors 2days ago..
Error Type:
ADODB.Recordset (0x800A0BCD) Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record. ../order/saveorder.asp, line 157
Browser Type:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)
Page: GET /main/saveorder.asp
Could you check my code below and let me know what possibly the error is?
I'm trying to pull the last 5 records from my database.
<% j=5 rs.MoveLast While ((j>0) AND (NOT rs_article.BOF))%> ''Execute HTML and data insertion here
<%rs_article.MovePrevious j=j-1 Wend%>
Everytime I attempt to run this code, I recieve an HTTP 500- Internal Server Error. It tells me no more than that. I know that my connection settings are OK because when I move forward through the database (first five records), the code executes without error. And yes, my Cursor type is Dynamic.
Alternatively, I would also like to know how to add new recordset to the beginning of a database rather than the end.
I have an Access database with two fields that I would like to group by. The two fields are location and department. Field names are "Location" and "DeptName".
I have the code correct for grouping by location. That code looks like this: Code:
I have it at the moment that on the main default.asp there is a recordset that will display all records within that table, these are a list of forums that will be available.
I have a table that will show the forum name, and the description. This table is then looped using Do while not, now what i need to do is show how many records in the Treads table are related to each forum using asp. Code:
when i update a database from an asp page i get the error:
**filename** Source: Microsoft JET Database Engine Error: 80004005 Description: Record is too large. Line: 435 Column: 0 Code: Connection.Execute(sSQL)
is there a limit to the maximum updatable fields that anyone knows? the fields are text but theres 62 to update, it seems to top out at about 18 fields?
I'm making a leaderbord in golf and i only want the top 3 leaders out from the database. My code is as follows.
<% Set Conn = Server.CreateObject("ADODB.Connection") Conn.Open "Driver={MySql}; Server=myserver; uid=username; pwd=password; database=database; option=3; port=3306;" Set rs = Conn.Execute ("Select TOP 3 FROM leaderboard ORDER BY points desc") WHILE NOT rs.eof %>
I'm getting this error message. 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 '3 FROM rangliste ORDER BY Oakies desc' at line 1
I have a javascript function that sends table data to excel. One of the tables is 238 rows, not big but it doesn't send, i know the code works because i tested other scenerio's and they all went to excel. Does anybody know how many records you can bring to excel?
How can I get the last two records of a RS,I use this code to get the LAST record,but I want the LAST TWO records.
Code:
Private Sub GetLatestRecord() Dim SQL SQL = "SELECT * FROM tblHouses WHERE DateAdded = (SELECT Max(DateAdded) FROM tblHouses)" SET objRS = objConn.Execute(SQL) End Sub
Im having some trouble displaying top 10 records.here is my sql in my asp
strSQL1 = "SELECT Top 10 * FROM tblFlashinfo ORDER BY Vote_Score DESC "
it orders them correctly but displays all of them not just the top 10 . How can i fix this?also i have another question, i need to make sure a user can only submit a form with the same hidden field value once in a 24 hour period. Is this possible and if so how may i do this? both problems can be seen in this little system im making.
id will be autonumber and gift_id will be alpha numeric field . i want to generate this table with a query. i want to have the alpha numeric field to be 12 digits long. so i want to have like 50,000 records for it. how can i do it.
I'm writing a news script in asp with an access database. I want to show the last/latest 3 records, and have all the rest of them ordered into pages of 3 in an archive. How can I do this please? 'cause I know how to show the first 3 records but I can't work out how to show only the last 3.
I basically created 5 different recordset with names of ObjRS2 ---> ObjRS6 The code is pretty easy to understand, but I'm missing something
<% for (i=2;i<=6;i++) { %> all of my HTML code calling the Recordsets....example <tr> <td> <%= objRSi("something")%> <----- the "i" is where i want the counter obviously </td> </tr> }
I have a database set up for a survey where in the Answers table I have columns QuestionID, SurveyID, and Answer. Because my survey has about 300 possible questions it's impossible to make a column for each answer. So if I need to select the answers from a specific survey for a specific question and I have about 50 entered in the database my loop will have go keep going for about 15000 times. What I'm trying to find out is if there is a way to create a record set by selecting a survey by it's ID and then when I only have about 300 rows in the record set select answer from the record set using the questionID. This is to update the answers for the survey. Also, another possibility would be update the recordset and then update the database. Is it possible to do that? Any directions to some code?
Doing a "modify a registry" html, I need to use the content of a recordset as an initial value for a text input , but it does not function the way I need to; this code gives me an error, look:
the error shown is "Error de Microsoft VBScript en tiempo de ejecución error '800a01c2' Número de argumentos erróneo o asignación de propiedad no válida: 'ob_rs' "
i ahve a recordset which takes data from a database using the shape command in a SQL statement. now i want it to show the data in a tabular fom such that the parent field has to it's right the child fields with out repeating the parent field again and again. And this done, the child field in the table should have the grandchild fields to is right and as before without repetition of the child field. and all of this in a tabular form!!! i use a similar sql statement as below: SQLTRY = "SHAPE {SELECT * FROM A} APPEND ( ( SHAPE {SELECT * FROM B} APPEND ({SELECT * FROM C} RELATE MachineNum TO MachineNum) AS rsparts) RELATECategoryNum TO CategoryNum)"
I have the following code: Code: Set RS = Server.CreateObject("ADODB.RecordSet" ) RS.CursorLocation = 3 RS.Open ("SELECT * FROM " & the_table_name & " WHERE " & job_id_field & "=" & request.querystring("job") &""), cn, adOpenDynamic Both have connections via the following string:
Code: set cn = server.createobject("adodb.connection") cn.Open ("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath(database_map_path)) & ";" Only difference is that the newer version has the connection string included in another file, and the "RS.OPEN ..." line on the recordset code gives an error: "Too few parameters". Expected 1.
can anyone explain to me what the code is trying to do?
if rsHistory(2) = "i" then v_HistOperation="Clock - In" v_HistTime=rsHistory(0) else if rsHistory(2) = "o" then v_HistOperation="Clock - Out" v_HistTime=rsHistory(1) end if
I'm working on a website where a compiled object returns a recordset. When I access the recordset, the memo fields are truncated. Is there anyway to get the full data from the existing recordset or is that a problem with the object itself and how the data is being queried (from SQL Server)?
I have a recordset full of data from form input. I would like to insert this data into a table where the recordID = the recordID from a query string. Is this possible with recordsets? To specify where to add the record, as opposed to just inserting a brand new record?