Strange Value Returned From Recordcount
why a ADO recordset.recordcount would return a -1? I have confirmed that it has records in it by writing some values to the screen. Why can't I count the number of records returned though?
View Replieswhy a ADO recordset.recordcount would return a -1? I have confirmed that it has records in it by writing some values to the screen. Why can't I count the number of records returned though?
View RepliesI'm simply trying to get a number of records returned in a recordset, and
just get a -1. I have looke din a few books and other references, can't
seem to find any answers. Anyone have any idea why I can't get a real
number? For the record, the recordset is not empty. In fact, it has many
records which I can see plainly on the screen. But when I do response.write
rs.recordcount, it just shows -1
i tried using a few method from the forum and fail. So anyone can help me out with this, i wanted to count the total number of record in the on of the table Namecard, so tried this code but fail, anyone can help me out? Code:
View Replies View RelatedOur application currently runs on aWindows 2000 Advance server with Oracle 8i and Microsoft IIS 6.0. We are changing servers and will now be running a Windows 2003 server with Oracle 8i and Microsoft IIS 6.0.
The .RecordCount property does not work on the server. It returns a -1. We have not changed any code.
Any idea why this would happen? Are there certain parameters that have to be set to get the .RecordCount to work?
I have an ASP page calling a VB COM calling an SQL Server stored procedure. What I would like is to return a recordset to ASP (works fine) and obtain the RecordCount (doesn't work).
The problem seems to be the difference between adOpenForwardOnly and adOpenStatic of the recordset (adOpenForwardOnly is default and doesn't support RecordCount). Unfortunately, I'm unaware of how to specify adOpenStatic for the recordset.
I've seen the "RS.Open SQL, Connection, adOpenStatic, adLockReadOnly" method, but my recordset is populated by a stored procedure "Set objRS = objCmd.Execute" ... any ideas how I can obtain the RecordCount (short of having the stored procedure return a count)?
Also does it matter where I specify the adOpenStatic (ie, in VB COM or ASP)?
I have compiled an activeX dll and pass variables using asp into functions within the dll.
When I test this running the code with Visual Studio the data is output correctly to the browser, however when I compile the code and run the same code the data is different! This is confusing me as to why this is happening....
I always re-start the web service after registering the dll...
Any ideas?
SET objRds = Server.CreateObject("ADODB.Recordset")
objRds.CursorType = 1
objRds.LockType = 3 'adLockOptimistic
objRds.ActiveConnection = objConn
objRds.open strSql
objRds.Recordcount
when i run the srl in query anaylzer, i get records, more than 1 but record count gives me -1 .
I've like to check whether the recordcount equals 0, 1 or greater than 1. I'm still getting to grips with ASP, but hope this isn't too hard. Coming from CF background - have sussed out conditional stuff in ASP, but need to do recordcounts for validation.
View Replies View RelatedI have this:
intTotalNumNewsEntries = rsNews.RecordCount
to count total records in rsnews table, how do i change this to count not all the records, but count the records that has a certain field with a value in it? ie:
intTotalNumNewsEntries = rsNews.somedbfield.RecordCount
I know for a fact that in my database, I have three records under the users
table. However when I execute this code:
I have a page that lets the users make contact groups and send an email to
them. I have a form that lets the user enter the details of his message
including his full name and his email address. Once this form is submitted,
I do the following to get a string for .From property of the CDONTS mail
object:
Sender = userFullName & "<" & userEmailAddress & ">"
Now I stumbled upon a bug where if the user adds a title to his name (i.e.:
"John Smith, MD"), the address for the recipient gets truncated where the
comma is and the recipents can't reply as the address is now invalid. Is
there a way to encode any special character in the string so that it will be
mailer friendly?
I keep getting an error in coding. I am using Dreamweaver MX 2004 and once I
preview it in IE it works then once I press F5 to 'refresh' it fails again.
The IE error returns this link
http://support.microsoft.com/defaul...Q241271&sd=tech
It regards the following : IIS 5.0 Continues to Return 500;100 Error Page
with Response.Buffer Set to False
Does anyone know what this means and how to fix it?
P.S The previous thing I was doing before the problem was setting up 'data
bindings' in DWMX - to be fair this was somewhat a trial and error approach
and I'm not sure if I've damaged IIS or DWMX in someway.
When I use the following, the RS.recordcount is -1. I also can't do a RS.moveprevious.
What have I overlooked? Code:
Can anyone help me with this error?
code start ____________________________________________
Microsoft VBScript compilation error '800a03ee'
Expected ')'
/example.asp, line 142
Private Function FuncDiff(ByVal DateOne As DateTime, ByVal DateTwo As
DateTime)
------------------------------------------^
code end ____________________________________________
I'm using multiple recordsets on a page, and they are all returning correct results and enough of them. My problem is when I try to access the recordcount property rs.recordcount, they all return a result of -1. This would usually mean that no records are returned. So why is showing my recordsets that are displaying records with recordcounts of -1. I can't seem to figure out.
View Replies View Relatedcan anyone tell me why this chunk of code returns "-1"
'dbcnx is database connection
sql = "SELECT * FROM articles"
Set rsArticles = dbcnx.Execute(sql)
rsNumRows = rsArticles.RecordCount
Response.Write("Viewing " & rsNumRows & " record(s).")
even though the db has pulled at least 10 records... i cant figure it out... it has broken alot of my code.. and i've been forced to find different means of making the same code work in asp that i could write quickly in php. i'm trying to learn asp now, and i'm just having problems with this..
I'm running ASP under IIS 6 with Tomcat. During the process, Tomcat will
forward to an ASP page with some data and those data will be written to MS
SQL and display some information in that particular ASP page. The Servlet
has no unsafe code. The strange thing is that all the data is written
correctly in the MS SQL with correct user and related information but the
data might become blank or send to different users in that ASP page.
Does anyone know what might cause this strange behavior ?
I have:
strSQL = "SELECT * FROM newarchive WHERE Program_Title LIKE '%" & program & "%' ORDER BY ID"
set objRS = objConn.Execute(strSQL)
Response.Write "There are " & objRS.RecordCount & " results."
I get -1 for the count on every search.
I searched the web for this, but couldn't find any reason as to why this was happening to me. I have a database set up with one record in the students table. I just issused a query "SELECT * FROM students" to test my DB. When I try to get the number of records with adoRS.RecordCount, it returns a -1.
Code:
set adoConn = Server.CreateObject("ADODB.Connection")
set adoRS = Server.CreateObject("ADODB.Recordset")
adoConn.Open "DSN=myodbc"
adoRS.ActiveConnection = adoConn
adoRS.Open "select * from students"
response.write(adoRS.RecordCount)
I do have an entry in the students table, so the RecordCount should be 1. BTW, I'm using the latest MyODBC 3.51 driver.
recCount = rsFaq.RecordCount
Response.Write("Total number of records: " & recCount)
it outputs -1 even though there are 4 records, how come?
i use this code;
Dim aCount
rsArchive.Open "SELECT * FROM qryArchive", db
aCount = rsArchive.RecordCount
but why aCount is still -1? the actual recordcount should be 4?
I'm having a hell of a time with this...
From researching multiple websites, specifying the asOpenStatic cursor should return the correct RecordCount.
Here is my code:
sql = "SELECT UserID,UserName,Password,AccessLevelID,LockThreshold,Active FROM tbl_users WHERE UserName = '" & username & "' and Password = '" & password &"' "
set rs_login=Server.CreateObject("ADODB.Recordset")
rs_login.Open sql, conn, adOpenStatic', adLockReadOnly, adCmdTable
if rs_login.RecordCount <> 0 then
Response.Write("Login Successful" & "<br>")
Response.Write("Record Count: " & rs_login.RecordCount)
end if
I know I can use the select count(*) instead, but I've been researching this for quite some time now and I would like to know what's wrong.
im having returning the recordcount of my recordset. i have already set the cursor to be adOpenStatic but it still returns -1.
View Replies View RelatedI have a recordset object generated by the command object
as in recordset object=command.execute
now recordset.recordcount gives me -1 !!!!
the actual record count is 7!!!
Any body who can tell em how to change the cursor type of the recordset
which is generated by a command object!!!
when the recordcount of the recordset of a adocon is -1, how can I write the record count correctly? I once tried:
rs.movelast
response.Write(rs.AbsolutePosition)
it report the following message for the movelast method
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E24)
Rowset does not support fetching backward.
I have developed a site for my client,
eg., www.abc.com
I have registered the domain with godaddy and mapped the dnc to my server (Windows 2000)
When i browse that site using that www.abc.com, in one of the pages i found that the session value is lost. This happens only in some machines not same with all. Most of the machines works that site properly. But not the same in some machines. All machines has configured same.
The exact part is
eg.,
customerdata.asp
session("custdata") = request("name")
response.redirect checkout.asp
in checkout.asp
if i give response.write for that session("custdata"), In some machines i m not getting the value.
**MySQL is accessible via ODBC manager and MySQL -Front. I am able to modify the databse. I can not access database from the ASP page that I did not modiy after the last successful interaction with database**
MySQL 4.1/IIS
Everything was working fine until last night PC shutdown to give it a break, was running for a few days. Today, after reboot, the ASP page, and my entire site for that matter, stopped working.
Here is the connection string that was working:
dbPath = "SERVER=localhost;DATABASE=molsonbubba;UID=xxxx;PWD=xxxx;OPTION=35"
useDSN = False
If useDSN Then
cString = dbPath
Else
cString = "DRIVER={MySQL ODBC 3.51 Driver};" & Server.MapPath(dbPath)
End If
Here is the code that throws the custom error (Database is not found) and stops. If I remove the code I am able to get the site up but no db operations work as I get a "HTTP 404 - Page not found error" ? Code:
I just re-uploaded my .asp site to a new host.
But one of my pages now bugs, I get this error message in a Windows alert box:
Redirection limit for this URL exceeded. Unable to load the requested page. This may be caused by cookies that are blocked.
All other pages work fine.
Not sure if anybody has run into this problem. I'm using ASPEmail from Persits to generate an email and send it. The problem is that when I check the email that the asp code sent using Outlook Express or Outlook the email gets cut off 3/4 of the way. If I check the email on hotmail, yahoo mail, any other email program....the email comes in full. Any ideas why this might be?
View Replies View RelatedI 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)
Can someone explain this:
-----------------------------------------
CQuantity = 8
if 4 < cQuantity then (works)
-------------------------------------------
'Get Record Count of This Type of Property
set rsProp1 = server.createobject("adodb.recordset")
rsProp1.pagesize = 1
mysql = "select * from Property where PropTypeID="&cAccomID
rsProp1.open mysql,cn,3,3
response.write(rsProp1.recordcount) >> = 4
if rsProp1.recordcount < cQuantity then (DOES NOT WORK!!!! QUANTITY IS STILL 8)
When adding i am checking if that name already exists in the DB and if so i am poping up the message that name already existing.
It is working perfectly in my win2000prof and i have tested in both in my localhost and ftp servers and in both places it is working as i ahve expected.
But when the same application is opened in winxp i have a strange problem coming. When i add a new list , then it checks for the name and what happens is every time i add a new one and even if there is no matching record or matching name avialable for that record, javascript popups saying "Favourite List Name Already Exists" and the strangest part is the insert part also working. That is both if and else part are working together. I am getting this problem only in XP. Code:
A bit of a strange request this, but I do have a reason When using request.form to access a forms elements data, is it possible to btain the elements type.
For instance whether the field (element) its being passed from was a hidden field, a text box etc etc! I've hunted everywhere, and tried lots of variates but I couldnt find anything..