p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

asp_databases thread: Conection Problem


Message #1 by "Myle" <Myle.Pham@n...> on Wed, 26 Jul 2000 22:48:19
Hi All





My code is like this: 

dim oRs

set oRs = Server.CreateObject("ADODB.Recordset")

Dim strQuery, TempStatus, Begin

strQuery = BuiltQuery()

oRs.Open strQuery, "DSN=OrclCore;UID=coredevl;PWD=coredevl ;" , 

adOpenDynamic,, adCmdText

oRs.Movelast

reccount = oRs.Recordcount

response.write reccount



I have this error message:

Microsoft OLE DB Provider for ODBC Drivers error '80040e24' 

The rowset does not support fetching backwards 





After it is fixed the following line:

oRs.Open strQuery, "DSN=OrclCore;UID=coredevl;PWD=coredevl ;" , 

adOpenDynamic,adLockOptimistic, adCmdText





I have this error message:



ADODB.Recordset error '800a0bb9' 

The application is using arguments that are of the wrong type, are out of 

acceptable range, or are in conflict with one another.





Please tell me what I did wrong ?



Thank you in advance,



Myle

Message #2 by "Fredrik Normen" <fredrik.normen@s...> on Thu, 27 Jul 2000 13:0:15
Why do you use MoveLast before you use RecordCount.

There is no point for doing that.



Do you use Microsoft OLEDB for Oracle ?



/Fredrik Normen

Message #3 by "Myle Pham" <myle.pham@n...> on Thu, 27 Jul 2000 08:48:03 -0600
Hi Fredrik,



I have learn from the previous reply from Ponsingh  .  The whole message is

being copied with this E-Mail.  Do you think my problem is causing by the

Oracle Driver ?



Thank you



Myle





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

In ADO, objrecordSet.RecordCount will never give the correct results.

To achieve this, u have to add 2 more lines of coding.

objrecordset.Movelast

reccount = objrecordSet.Recordcount

objrecordset.Movefirst



Now u will get the number the records in the objrecordset.



Regards

Ponsingh





----- Original Message -----

From: Raymond

To: ASP Databases <asp_databases@p...>

Sent: Tuesday, July 25, 2000 5:53 PM

Subject: [asp_databases] How to count the number of rows in the recordset





> Dear all,

>

>     I have problems in counting the number of rows in recordset. I have

> tried objRecordSet.RecordCount, it's fail. I have heard that it can be

> retrived from SQL statement like "select Count(*) from TABLE where

> FIELD='abc'" , but how should I get the Count Number. Should I just use

> objRecordSet.Execute? How are the syntax statement to get the Count number

> in SQL.

>     Thanks so much for any suggestion.

>

> >From Ray



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











-----Original Message-----

From: Fredrik Normen 

Sent: Thursday, July 27, 2000 1:00 PM

To: ASP Databases

Subject: [asp_databases] Re: Conection Problem





Why do you use MoveLast before you use RecordCount.

There is no point for doing that.



Do you use Microsoft OLEDB for Oracle ?



/Fredrik Normen

Message #4 by "Myle Pham" <myle.pham@n...> on Thu, 27 Jul 2000 09:00:24 -0600
Hi Fredrik,



I forgot to tell you that I am using Microsoft OLEDB Oracle driver.  That is

what I think because when I tried to enter the wrong user name and password,

it gave me this error message:



....................

Microsoft OLE DB Provider for ODBC Drivers error '80040e4d'



[Oracle][ODBC][Ora]ORA-01017: invalid username/password; logon denied

................



Thank you





Myle



-----Original Message-----

From: Fredrik Normen 

Sent: Thursday, July 27, 2000 1:00 PM

To: ASP Databases

Subject: [asp_databases] Re: Conection Problem





Why do you use MoveLast before you use RecordCount.

There is no point for doing that.



Do you use Microsoft OLEDB for Oracle ?



/Fredrik Normen



Message #5 by "Fredrik Normen" <fredrik.normen@s...> on Thu, 27 Jul 2000 18:24:48
Can you try this exampel:



dim oRs

set oRs = Server.CreateObject("ADODB.Recordset")

Dim strQuery, TempStatus, Begin



strQuery = BuiltQuery()



oRs.CursorLocation = adUseClient

oRs.Open strQuery, "DSN=OrclCore;UID=coredevl;PWD=coredevl;" , 

adOpenStatic,, adCmdText

reccount = oRs.Recordcount

response.write reccount



Some providers doesn't support recordcount and some other function.

Maybe this is your problem.



Instead of using ODBC try to use OLE DB.

You can create a connection string with Microsoft Data Link.

If you are running win 2000 just create a new notepad document or something 

like that, rename the new file to something.udl

Dubble click on the file. Now on you can choose what type of connection you 

want to do, choose OLEDB for ORACLE. And write the server name etc.



Drag this file to notepad and copy the second line.

Paste it into you code, and then try to see if it works.



/Fredrik Normén


  Return to Index