Select Count(*) Always Returns Zero

using mysql - vbscript and oledb provider

I have a table with 2 records

I do this in asp

rs.open "select count(*) as countervar from sqltable" ,oconn,1,1

response.write rs(0).value or response.write rs(0) gives zero and not 2 as to be expected

Also I would also like to be able to do calculations like this

rs.open "select 10 * 2 as result" ,oconn,1,1

response.write rs(0) also gives zero and not 20 as expected

can't this be done?

View Replies


ADVERTISEMENT

Count = Rs.RecordCount - Returns -1?

I have this code and it keeps spitting out -1 when I know there are 9 records, please help me.

Randomize

DIM cat,random_number(), counter, check,count

cat = Request("category")
Set cnn1 = Server.CreateObject("ADODB.Connection")
openStr = "driver={Microsoft Access Driver (*.mdb)};" & _
"dbq=" & Server.MapPath("database/images.mdb")
cnn1.Open openStr,"",""

sql = "SELECT * FROM gallery WHERE category = '" & cat & "' Order by ID"
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open sql, cnn1, adOpenDynamic, adLockOptimistic, adCmdText

count = rs.RecordCount

redim random_number(9)

View Replies View Related

Select Count(*)

I have tried everything possible and still I cant understand why one of the codes work.
This one works, uses a Form to get required info. Code:

View Replies View Related

Select Count(*) ??

I need to set a variable to a select count(*) so I can check if something exists.
For example I have:

SQL = Select field from table where a = adf and b = fdad
set rs = conn.execute(sql)

variablec = rs("c")

But I want to do it with a count so i can use:
If variablecount > 1 Then
newvariable = true

down the line.

View Replies View Related

Select COUNT ?

My problem is using the SELECT COUNT to count the total of call in students. I get the correct count when they is no zero record. But when zero record returns, the count got mix up.. Code:

View Replies View Related

Select Count

How do I count the number of students in a table where their next_Action field is equal to "Follow up". Plus, how do I display out the result?

View Replies View Related

Select Count

Code:

dim sumv, mySQL, conntemp, rstemp
mySQL="SELECT COUNT(*) FROM crminfo where open = '1'"
call getFromDatabase(mySQL, rstemp, "sort2cat.asp")
if not rstemp.EOF then
response.write rstemp.count
end if

View Replies View Related

Select File Count

i have a bit of a weird question . I'm looking for a pull statement that pulls the number of files in a specific folder , But at the same time it wouldn't pull the number of pictures in this folder either . I have no idea how to write this code and I'm wondering if anyone could help me out?

View Replies View Related

Select Count Statement

After i have SLECT COUNT(X) as "A" from....

I want to issue a condition to check for the number of records. this is what i do

Code:

SQL = "select count(*) as "A" from..."
set objRec = objConn.execute(SQL)

if objRec("A") = "3" then

is this statement correct? Doesn't seems working.

View Replies View Related

Canīt Get Select Count(*)... GROUP BY To Work

Iīm trying to build a forum of my own but have stumbled on my first problem as early as the opening page.

To the problem: I want to show a simple forum layout with tables looking something like
this:

Forum Name | Topics | Posts | Last Post
---------------------------------------------------
General | 1 | 4 | Webmaster, 09 Feb -06

To do this I use the following SQL;

sqlPosts = "SELECT Date, COUNT(Date) as NrOfPosts FROM ForumPosts WHERE
ForumID = " & rsForum("ForumID") & " GROUP BY Date ORDER BY Date DESC"

But this doesnīt give me the right numbers. Instead of showing Topics to
be 1 and Posts to be 4 it shows Topics to be 1 and Posts to 1.

But if I use a simpler sql, like this;

sqlPosts = "SELECT COUNT(Date) as NrOfPosts FROM ForumPosts WHERE
ForumID = " & rsForum("ForumID") & " ORDER BY Date DESC"

Then it works, but I canīt get any other info from the table, like date,
userid etc. Code:

View Replies View Related

ASP XML Returns

I currently am posting data to another site with ASP and in return that site returns a page that is XML. How can I grab this data programatically?

This is what the returned page looks like:

<?xml version="1.0" encoding="UTF-8" ?>
- <!-- Turnitin API Return Data
-->
- <returndata>
<rmessage>Successful!</rmessage>
<originalityscore>92</originalityscore>
<rcode>61</rcode>
</returndata>

View Replies View Related

Carrige Returns

I have the following:-

<tr>
<td width="20%"><b>Typical Playing Hours</b></td>
<td width="80%"><textarea rows="3" name="TIMEON" cols="40"></textarea></td>
</tr>


Which users insert what time people usually play..

but if someone enters

Sat 10-11
Sun 13-15

it enters into the database as

Sat 10-11 Sun 13-15

how can i get it to carry the carrige return then it inserts it into my databaes?

View Replies View Related

Pagenum Value Always Returns 0

i am making a recordset paging in asp. the problem is the Previous Page, Next Page, and the Last Page wont work. only the first page is working. i have found out that the "pagenum" value is always equal to zero(0). could anybody help me with this problem? Code:

View Replies View Related

Carriage Returns

how I can keep the formatting (carriage returns) that the user enters into a memo field and then display that later. I figured I might be able to use:

'replace carriage returns with BRs
comment=Replace(comment, chr(13), "<br>")
but obviously net.!

The <pre> tag doesn't sem to help either as the embedded return is lost by the time you get past Request.Form

View Replies View Related

Request.Form Returns Nothing

I have a long list of checkboxes and a text field is associated with
each checkbox. So I created a loop that should get the value of each
text field that has a marked checkbox next to it. Here's my code

for each g in gildi
aths = Request.Form("rok_" & g)
...
next

then I create a query with the value and send it. Anyway here's my
problem:

the aths variable gets the correct value on the first iteration but is
blank every time after that.

View Replies View Related

Sql To Asp Formatting Carriage Returns

I am using asp to retrieve data from an SQL Server database and display it on a web page. The data in the database has been formatted using multiple carriage returns however, when the data is displayed on the page these carriage returns are lost.

View Replies View Related

Wscript.Shell.run Returns 254

I am trying to run a command line from an ASP page. I am using windows 2003 with IIS6. I am able to get this to run on my local machine (Windows XP IIS5). Here is my code:

View Replies View Related

ADO.RecordSet.Open Returns

What does ADO.RecordSet.Open return when the SQL query is an UPDATE or INSERT query?

View Replies View Related

HTTP_REFERRER Returns Blank

The code referer = request.servervariables("HTTP_REFERER") used to return a
requesting URL. It now returns blank. Anyone any idea what is happening?

View Replies View Related

SQL Table Returns All Records

I have this sql query

SQL="SELECT title,body FROM cinema WHERE date_end > #" &date()& "#"

cinema is a table which contains announcements about cinema title,body (txt fields)are columns of my a table called cinema date_end(DATE/Time Field): is a date (DD/MM/YYYY, short format).This date shows when the announcements expire .But SQL returns all the announcements that the table contains even those that have already expired. Why??I cant find any mistake.

View Replies View Related

Removing Carriage Returns For DB

I have a form with a <textarea></textarea> to receive user input. This input is then stored in a database and sent by fax... I need to be able to remove the carriage returns (enter key... vbcrlf...) from the input so that somebody doesn't do something like fill the textarea with 100s of keypresses of the enter key and end up spitting out tonnes of
blank pages on the fax machine.

View Replies View Related

Sql To Asp Format Carriage Returns

I am using asp to retrieve data from an SQL Server database and display it on a web page. The data in the database has been formatted using multiple carriage returns however, when the data is displayed on the page these carriage returns are lost. Does anyone know a way around this problem?

View Replies View Related

Response.Write Returns ???

I am working with NT4 and when I do a Response.write it returns the value ???????. I have been developing for many years now and this is the first time I have seen this. The IIS version is 3 (I think), and we are running the same setup on two other systems and neither of the other systems have this problem.

View Replies View Related

Removing Carriage Returns

I have a text box that a user is allowed to enter what ever text they wish. I then take the text store it in a Database, and at a later time print it in a document. All that part I have done.
The problem I'm having is I have a client that hits return at the end of their last sentance. When this prints on the document, it sometimes causes an extra blank page to be produced to account for the last carriage return, depending on how much text they have entered.
What I'm looking to do is take out any whitespace or un-needed carriage returns at the end of the string.

View Replies View Related

ObjRst.pagecount Returns -1 StoredProcedure

I'm writing an ASP page calling stored procedure from my database, in which I used Command Object. However, I can't get the pagecount or recordcount by the command: objRst.pagecount or objRst.recordcount since it returns -1, which, from the documentation, means these methods are not supported for some strange reason.
I'm thinking maybe it's becasue I used the Command Object with stored procedure. However, if I put my sql query into a string and then open it from a connection obj, the pagecout method would work fine.

The code is as follow:
====================
dim param
... ...
Set objConn = Server.CreateObject("ADODB.Connection")
Set objCmd = Server.CreateObject("ADODB.Command")
set objRst = Server.CreateObject("ADODB.RecordSet")

objConn.Open strLogin
objCmd.ActiveConnection = objConn
objCmd.CommandText = "test.my_procedure.method1"
objCmd.CommandType = 4

objCmd.Parameters.Append objCmd.CreateParameter("param", 200,1,50,param)
set objRst = objCmd.Execute
objRst.CursorLocation = adUseClient
'objRst.Source = objCmd [NOT SURE IF CORRECT, so cmt out, but doesn't affect my question]
objRst.CursorType = adOpenStatic
myrecordcount = objrst.PageCount [RETURNS -1 !! :confused: ]


======================================

View Replies View Related

Crosstable Query Returns Too Many Records

I'm writing a work schedule application in ASP, and I am using an Access 2000 DB with the following tables:

WorkSchedule
--------------------------
| ID | Date | EmployeeID |
| .
| .
| .

Employees
---------------------
| EmployeeID | Name |
| .
| .
| .

Status
----------------------------------------------------
| StatusID | DateFrom | DateTo | EmployeeID | Type |
| .
| .
| .

I need to retrieve a list of employees, which are not scheduled for work between the given dates and which have no status (sick leave, maternity leave etc). The object is to see which employees are available for scheduling on the different dates.

The resulting table/recordset should contain one record per date per available employee (see example below). Code:

View Replies View Related

9 Random Records - Returns All But First Record In RS

I have been using this script which basically works fine, with on hitch. I populate a recordset from a database. Then, use the total number of records as a UBound.

I then want to display 9 random records. I get my 9 random images, but for some reason, if I do a sort by ID on the database, the lowest numbered ID file never comes up in the list. Here is my code: Code:

View Replies View Related

CDO.Send Returns Error '8004020f'

I'm trying to set up a very simple asp page that sends me an email when it runs. This is just to try and get CDOSYS working so I can send out emails from my website.

Everything is fine right up until I execute the ".Send" method.
What could be wrong? What does the error mean?

The output from the source below is:
"test1 error '8004020f'

/mailtest.asp, line 34"

Here it is: Code:

View Replies View Related

Removing Trailing Carriage Returns

If I want to remove x-amount of trailing carriage returns from a string in ASP (ie, someone has entered text into a text area and left a few carriage returns) - what's the easiest way to do this?

Trim() only removes white space

Also, I don't want to remove carriage returns within the main body of submitted text.

Any ideas if there's an easy way to do this?

View Replies View Related

Formatnumber Function Returns Error

The following code with formatnumber function returns me the following code. Why?

<td align="right"><Font
class=content4><%=formatNumber(ars.Fields("SOLD_AMOUNT"),2)%></td>

Microsoft VBScript runtime error '800a000d'

Type mismatch: 'formatNumber'

View Replies View Related

Adding A Checkbox Which Returns Value To Database

I am trying to write a basic holiday booking system for the company I work for, it is quite simple in that the user selects the dates they want off work, and they can view if it has been approved or not. It has an admin screen so that the manager can go in and approve the holiday request.

To do this I would like the admin screen to display all the dates in the database that the user has selected off and to have a checkbox next to each that the manager can select to approve it. However I don't know how I would do this, at present all it does is read the info in the database. Code:

View Replies View Related

Prevent Counter From Incrementing When Someone Returns

I have a counter (alright one I found on asp101.com) that checks for a
session variable to prevent the counter from incrmenting if a user refreshes
the page or returns to the page during the same session. The problem is, it
also prevents other page counters from incrementing. Here's the code for
this part: Code:

View Replies View Related

Textarea Carriage Returns Not Showing Up In Email

I have a textarea that is being sent to email using an asp code to process the form.

strBody = strBody & "<br><br><b>Resume: </b><br>" & Request.Form("resume")

I want to keep the carriage returns for the textarea. How can I do that using the Request.Form?

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved