p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Classic ASP Professional (http://p2p.wrox.com/forumdisplay.php?f=63)
-   -   ADODB.RecordSet -- Error (http://p2p.wrox.com/showthread.php?t=35352)

nabeeljohn November 23rd, 2005 03:42 AM

ADODB.RecordSet -- Error
 
I HAVE THIS CODE IN MY WEBSITE:

<%@ language="vbscript" %>


<%


dim rsData
dim intPage
dim intTotalPages
dim fldf
dim intRec
dim strQuote
dim strScriptName

strQuote= chr(34)

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


rsData.pagesize=10
rsData.CursorLocation = adUseClient


rsData.Open "mydb", strConn, adOpenForwardOnly, adLockReadOnly, adCmdTable


If request.querystring ("page")="" Then
    intPage=1
Else

    If intPage<1 Then
    intPage=1

    Else

    If intPage>rsData.PageCount Then
    intPage=rsData.PageCount

    Else

    intPage=CInt(request.querystring("page"))

End If

End If

End If


rsData.AbsolutePage=intPage


Response.Write "<table border=1><thead><tr>"
For each fldf in rsData.Fields
    Response.Write "<td>" &fldf.Name&"</td>"
Next
Response.Write "</tr></thead><tbody>"


For intRec=1 To rsData.PageSize

    If Not rsData.EOF Then
    Response.Write "<tr>"

    For Each fldf in rsData.Fields
    Response.Write "<td>"&fldf.value& "</td>"

    Next

    Response.Write "</tr>"

    rsData.MoveNext

End If

Next

Response.Write "</tbody></thead></table>"


%>



AND I RECEIVE THIS ERROR WHEN I RUN IT.


Error Type:
ADODB.Recordset (0x800A0BB9)
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
/working/dbin.asp, line 21


Browser Type:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)



PLEASE GUIDE ME WHAT TO DO.

NABEEL JOHN


Nabeel John
0300-4124086

ChrisScott November 23rd, 2005 05:12 AM

Hi Nabeel,

I guess line 21 must be this one:

rsData.Open "mydb", strConn, adOpenForwardOnly, adLockReadOnly, adCmdTable

Have you set the value of strConn anywhere?

Do you have a table called mydb in your database?

Cheers,

Chris


nabeeljohn November 23rd, 2005 09:52 AM

Dear Chris,

Where to set the value of strConn?
Also tell me what it actually does?

I've an Access 2000 Database its name is "mydb" in ODBC, and its file name is also "mydb"

And it has a table called "pInfo" and has two fields "Name" & "EMail"..

Now Please guide me.

Hoping to hear from you soon.


Nabeel John
0300-4124086

ChrisScott November 23rd, 2005 12:46 PM

Hey Nabeel,

You need to use a valid connection string to your database in connStr, http://www.connectionstrings.com should set you on the right track (you could also use a connection object in place of a connection string, but you need a connection string to open that as well).

If you are opening the "pInfo" table with your recordset, the first parameter needs to be "pInfo" and not "mydb".

HTH,

Chris




nabeeljohn November 23rd, 2005 05:48 PM

CHRIS, WITH THIS CODE I RECEIVED THE SAME ERROR. PLEASE NOTE THAT I HAVE MY DATABASE IN ODBC W/DSN.
NOW WHAT TO DO?

---------------------------------------------------------------
set database=Server.CreateObject ("ADODB.Connection")
database.Open "mydb"

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


rsData.pagesize=10
rsData.CursorLocation = adUseClient


rsData.Open "pInfo",database, adOpenForwardOnly, adLockReadOnly, adCmdTable


Nabeel John
0300-4124086

Imar November 23rd, 2005 07:34 PM

Hi Nabeel John,

Looks like you haven't defined the constants like adOpenForwardOnly, adLockReadOnly and adCmdTable. Take a look at this FAQ to find out how to make those available in your code:

http://Imar.Spaanjaars.Com/QuickDocId.aspx?QUICKDOC=332

HtH,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Wake Up by Rage Against The Machine (Track 7 from the album: Rage Against The Machine) What's This?

nabeeljohn November 24th, 2005 04:29 AM

Thanks Imar,

It worked!

One more thing I want to know, how would this work if the user didnt have this file(msado15.dll) on his/her computer? Can I include it virutally or from my ISP's server or from my web hosting server? for I'm hosting my website on www.serversea.com

Cheers,
Nabeel



Nabeel John
0300-4124086

Imar November 24th, 2005 06:47 AM

The end user has nothing to do with this; this is a server side setting.

Depending on the configuration of your server with your ISP, you can try method 3. If that doesn't work, upload a copy of the file from your own machine to your server and then use method 2.

HtH,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.

nabeeljohn November 24th, 2005 05:23 PM

Thanks Imar, it worked!

Nabeel John
0300-4124086

uderodriguezjr November 9th, 2006 05:15 AM

Hi to all. Can someone help me with my code?
I'm new to ASP so I'm kinda having difficulties with coding.

I've been trying to fix it for two days and nothing happened.
It always gives me the same error:
ADODB.Recordset (0x800A0BB9)
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.

And it says that there is something wrong with line 4.

I am using two files here. The first one is an asp file (expprof.asp) which includes a database connection file (). And another file (expeduc.asp) which is also included in the first file ().
What I want is for expeduc.asp to display information from the database, that is, if the database contains the "id" of the person displayed in expprof.asp, otherwise, display an ADD form to add information related again, to the person displayed in expprof.asp

<%
  Set rsNum = Server.CreateObject("ADODB.Recordset")
  numSQL = "select * from educations where exp_id = " & Request.QueryString("id") & ";"
  rsNum.Open numSQL, adoCon, 3, 3 ---> this line is said to have the error

  'count the number of records the person has in the educations table
  cnt = rsNum.RecordCount

  'if there are no records then the system must require the user to enter the information in the form below
  If (cnt < 1) Then
  %>
    <form name="addeduc" action="expeduc.asp?inc=1&id=<% Request.QueryString("id") %>&view=1" method="post">
    <table align="center">
     <tr><td align="center" colspan="2">Education</td></tr>
     <tr><td colspan="2"></td></tr>
     <tr>
      <td>Education:</td>
      <td><input type="text" name="educ" size="30"></td>
     </tr>
     <tr><td colspan="2" align="center"><input type="submit" name="Submit" value="Add"></td></tr>
    </table>
    </form>
  <%
     Set rsEduc = Server.CreateObject("ADODB.Recordset")
     educSQL = "select * from educations"
     rsEduc.Open educSQL, adoCon, 2, 3
     rsEduc.AddNew
     rsEduc.Fields("exp_id") = Request.QueryString("id")
     rsEduc.Fields("education") = Request.Form("educ")
     rsEduc.Update
     'rsEduc.Close
     'Response.Redirect("expeduc.asp")
     'Response.Write("Add Something")
  Else
     'display the Education when there is a record found in the database
     Response.Write(rsNum.Fields(2))
  End If
%>


All times are GMT -4. The time now is 08:51 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.