Count No Of Records Returned
I have created a simple search engine which retrieves records from an access database using sql and displays them using ASP.How do I go about counting the number of records that have been retrieved?
View RepliesI have created a simple search engine which retrieves records from an access database using sql and displays them using ASP.How do I go about counting the number of records that have been retrieved?
View RepliesI have been using the following code to count the number of rows returned from a query:
Alldata = rs.Getrows()
NumRows = Ubound(Alldata, 2)
The problem is I am now having to limit the number of rows that it returns:
Alldata = rs.Getrows(300)
Now my NumRows always equals 300 no matter how many matches are found so my counter doesn't work. Does anyone know a way around this?I know that I can use SELECT COUNT(*)..... instead in an SQL query but that means making two trips to the server which I don't really want to do.
short n simple question: I want to display the number of records returned from a search. Code fragment as follows:
// d/b retrieval SQL code
SQLCode = SQLCode
Set objRS = objConn.Execute (SQLCode)
// displaying the returned results
Do While (Not objRS.EOF
<< spit out records >>
objRS.MoveNext
Loop
Now, is there an instance of objRS I can call that will just display how many records were returned? I tried objRS.Count on a longshot, but that didn't work
I've created a Stored Procedure which adds a new record and updates some more records and then returns the primary key for the added record.
The SP seems to work OK, but I'm having problems getting at the returned key in my ASP code:
"Item cannot be found in the collection corresponding to the requested name or ordinal."
A common error, but in this case I can't see why... I output the SQL instruction that is sent to the DB and have run it in Query Analyser and it runs OK and returns a single row, with a single column - the new primary key...
But when I try and access this in ASP, I get the error message....
I've been trying to find a simple way to count the records returned from a database query short of looping through the recordset and incrementing a counter.
I've tried the following without any success:
Ubound(select_rs) - afterall the recordset is returned in an array right? Ubound gives the following error: Microsoft VBScript runtime (0x800A000D)
Type mismatch
I've tried select_rs.count which gives the following error: VBScript runtime (0x800A01B6)
Basically, I've reached the point where I think I may have to loop through the recordset and count the number of records returned. Seems like an awfully inefficent way to do something so simple.
How do i Count Records with "the same values"?
Name, Age, Sex
John, 20, M
Barry, 24, M
Eve, 19, F
How do i Count the Males and Females?
Like "There is currently 2 M and 1 F registered"
To count them all I would just use rsTable.RecordCount, but dont know how to Count them the way i want them to.
Course_Info and Students. Course_Info holds all the information for each course that a student can sign up for. The Students table holds all of the student’s information. The field that ties the two tables together is Course_Name.
I have an admin page that I would like to display the total number of students enrolled for each class. How can I count the records in the Students table, and then display the total number of students that are enrolled in each individual classes?
I want to add an include line to my main page to veiw how many sites is in my database..
This what I came up with for example:
<!--#INCLUDE FILE="DBCONNECTION.ASP"-->
<%
DIM SQL,RS
SQL = "SELECT COUNT(URL) FROM TABLE1"
SET RS = SERVER.CREATEOBJECT("ADODB.RECORDSET")
RS.OPEN SQL, CONN, 3, 3
%>
How can i show the number only in my main page...
I am trying to count all the records that have the dates of 6/21/04 - 6/27/04. I am using:
sql = "SELECT Count(datecreate) AS ct " &_
"FROM Database_Name..TableName WHERE datecreate = '6/21/04' OR datecreate='6/22/04' OR datecreate = '6/23/04' OR datecreate = '6/24/04' OR datecreate = '6/25/04' OR datecreate = '6/26/04' OR datecreate = '6/27/04' GROUP BY LastName "
It only counts the records woth the date 6/21/04. Does anyone know how to fix this or a better way to do this?
I've got query which returns a bunch of dates, like this:
12/05/05
12/05/05
12/05/05
11/05/05
What I want is to find the largest number of same entries and store this number in a variable: so, for the example above, I'd want my variable to equal 3. Code:
I'm trying to count the number of records in a database table but I keep getting the result of -1 which is incorrect. I'm sure this is a simple thing but I'd appreciate any ideas. The code is as follows:
set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open (Server.MapPath("..databasesphonebook.mdb"))
set rsCount=Server.CreateObject("ADODB.Recordset")
rsCount.open "RoleCodes", conn, adOpenStatic
response.Write(rsCount.recordcount)
I know I've asked this before, and other people have too. But when I use that igrep search thing, almost all of the search results are scambled (when you clikc on a search result, its just a scambled up thread).So I'll ask again, because I have forgotten. I know that to count the entries in a recordset, you usethe following code...Code:
RS.RecordCount
But I know that you need something else, something about a client-side pointer? Without it Im just receiving -1 each time.
I think this should be simple but cannot find it:
I use a update query like
sSQL = "UPDATE PLAATSEN SET PROVINCIE='1' WHERE PROVINCIE='Noord-Brabant'"
ADORSEXECUTE(sSQL)
2 things I want to do, check if query is success and display message with number of changed records. How can I do this?
Trying to duplicate the functionality found on this page:
I have a new table i've created that stores peoples search queries:
INDEX, SEARCH, COOKIEID, CID, SUCCESS, DATE
I have a seperate table that stores my product data, including the keywords. My search function uses a LIKE %%examplekeyword to match searchs to the DESCRIP column in this inventory table.
How can I make one SQL query to display the same results as on the the example page? It's easy enough to SELECT the results, but how do I do a count of how many instances of that search word exist, inside the same SQL statement?
This is the code of the page that should display a column of records (categories of my blog), next to the number of articles contained in each category. Code:
View Replies View RelatedI'm trying to count all the records in a table [for which I'm using count()]and display a number for each record. Ofcourse the number is not being pulled from the DB. So my doubt is when we display all the records of the DB can we just assign 1,2,3.... to each record that is being displayed? Code:
View Replies View RelatedI have got an access database with 100's of records in it(each record is just one word/phrase)...i am looking to develop some asp code that will select all distinct values in that table and list the number of times that text appears.
For example in the table contains the following records: -
banana
apple
orange
apple
apple
orange
apple
I want the following output: -
apple - 4
orange - 2
banana -1
i have some problem in showing data. I have two tables
First table(containing Hosting categories)
Second table(Containg catagories data lik
url,keyword,description.....etc)
I want to display catgories names from first table and then diffrent catagories
total records from second table, like this
ASP.NETHosting(10)
Linux Hosting(20)
Windows hosting(13)
how can i Count and display number of records in table?
View Replies View RelatedHow is it possible to execute an exe from asp and get a returned string (no http headers in exe) ?
To run exe I use :
<%
cmdExe = sPath & "cgi-bin
equest.exe"
Set WshShell = Server.CreateObject("WScript.Shell")
sResult = WshShell.Run(cmdExe, 1, True)
Set WshShell = Nothing
Response.write sResult
%>
sResult always content "0" and not the string returned by exe file (something like "!!-1!blabla!blablablabla!")
- How is it possible to get the exe returned value ?
- Is there a solution with asp.net ?
When I do a query that I know has 2 rows, I get rs.recordcount equals -1. Same thing when it's just one row. I need something that gives me the number of rows.
View Replies View RelatedI am trying to update a record but it returns this error :
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near the keyword 'Function'.
/performaindia/security/functionssys.asp, line 210
Now at line 210, I have this function :
rs.Update.
I am getting this error on selecting an option :
Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC SQL Server Driver][SQL Server]Cannot insert the value NULL into column 'SystemUserOnly', table 'performaindia.dbo.SecurityTableFields'; column does not allow nulls. INSERT fails.
/performaindia/security/tablefields.asp, line 220
now the line 220 is an update statement :
rs.Update
I have a bit of a situation here, I own a job board and have multi-posting comapnies posting jobs to our database and we have returned values going back to them to tell them if the job vacancy was posted succesfully or not.
The problem I have is that our main ASP guru is of sick and the other is off away on business. I have pretty good knowledge of ASP but not as much as these guys. So I need to know how to send a response back to the posting company whether it has been succesfull in posting the job vacancy instead of sending back a page back displaying whether it was successful.
I define a recordset with a pagesize of 100 in my COM object and return this recordset to ASP. When I check my pagesize at the ASP level,it is 10 I assume this is the default.
I can set my pagesize at the ASP level after the COM function is called, but I would prefer to have this encapsulated within the COM.
I am not sure what way to do this, i want a specific row returned and displayed in asp but not in a text box, in acess and vb i ahve done this and its just a label but not sure in asp.
View Replies View RelatedI have an ASP/ADO application querying an SQL Server DB. I want know the most efficient way to determine if more than one row is returned from a query. If more than one row is returned, the user will be presented with a choice of which row to process. If only one row is returned, I want to skip this stage, and process that single row immediately.
I can think of a number of ways of acheiving this (eg. .recordcount) but I'm looking for the slickest and most efficient method.
I have a simple VBS to return some unless data (as a test) and it works correctly. Code:
View Replies View Relatedwondering if its possible to have some kind of searched word highlight! IE. every thing it throws up in return of search it will highlight why it has brought it up! so if search "a" all "a" in return results would be highlighted.
View Replies View RelatedI've got a DropDownlist with predefined numbers(5,10,15,20 etc.) which I
want to do a postback to the GridView pagesize, so that the user manually can
change returned rows. Is there a way to do that in the properties of the
Designview or must there be a code behind. If so, what is the code for this?
I am retrieving a response from another site but certain special characters such as ' (single quote) or "(double quote) and £ (pound sign are being returned as ?. The code i am using to get the page is as follows:
Set objhttp= Server.createObject("Microsoft.XMLHTTP")
objhttp.open "POST","http://www.mysite.co.uk/viewdetails-" & PrmRef & ".rsp",false
' objhttp.setrequestheader "Content-Type","text/plain"
' objhttp.setrequestheader "Accept-Charset","iso-8859-1"
' objhttp.setrequestheader "content-type","text/html","charset","iso-8859-1","application/x-www-form-urlencoded"
' objhttp.setrequestheader "content-type","text/html"
' objhttp.setrequestheader "Content-Type","application/x-www-form-urlencoded"
objhttp.send formData
prmResp = objhttp.responseText
I have tried setting various values for the requestheader as commented out above but with no success.
I'm currently developing on IIS 5, ASP 3 and MySQL 4.1 using the latest ODBC driver from MySQL.
Any time field I have return from the database is returned as the current date. I've tried every table which has a date, created tables which soley keep records on the date.
I've submitted the date from MySQL Query browser using CURRENT_TIME and from an ASP page. Both submit fine.
I've returned the record using a Recordset to move through each and filled an array using GetRows().
I have an ASP report that returns values from a SQL database and
formats the data in an HTML table.
I am trying to figure out a good way of using CSS to highlight the
table row that contains the highest value returned.
I tried storing the values in an array, and then used a function to
find the highest value. This worked, but then I couldn't really
figure out how to "tell" the report to highlight that highest value.
Could anyone think of an easier way?