Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error: Default property not found for object 1

Status
Not open for further replies.

Ciarrai

Technical User
Jun 27, 2003
17
US
I am using forms, etc in ASP and so need to know what the next number is available for use. I know the sql works, but for some reason I can't get it to print to the page.
I keep getting the following error: ASP 0185 (0x8002000E)Default property not found for object.


<% Set Conn = Server.CreateObject(&quot;ADODB.Connection&quot;)%>

<!--#include file=../includes/dbann.asp-->

<%dim NextID
NextNum=&quot;select Max(ACS_ROLE_ID)+1 from jjwwp.ACS_ROLE&quot;

set NextID = conn.Execute(NextNum)



response.write (NextID)
%>
 
The error is on the NextID object. The NextID object is a recordset object. There is no default method for this object. The easiest way to print out the contents would be to name your field your pulling back and print it out like this:
Code:
NextNum=&quot;select Max(ACS_ROLE_ID)+1 as MaxRoleId from jjwwp.ACS_ROLE&quot;
set NextID = conn.Execute(NextNum)
response.write (NextID(&quot;MaxRoleId&quot;))

This tells the recordset to look at the current record it is queued to and send back the value of the field MaxRoleId. You could also not bother putting the AS in your sql statement and simply refer to the field by number:
Code:
NextNum=&quot;select Max(ACS_ROLE_ID)+1 from jjwwp.ACS_ROLE&quot;
set NextID = conn.Execute(NextNum)
response.write (NextID(0))

This is shorthand (using defaults) for NextId.fields(0).value

w3schools.com has an excellent refernce for all of the ADO objects here:
-Tarwn



01010100 01101001 01100101 01110010 01101110 01101111 01101011 00101110 01100011 01101111 01101101
29 3K 10 3D 3L 3J 3K 10 32 35 10 3E 39 33 35 10 3K 3F 10 38 31 3M 35 10 36 3I 35 35 10 3K 39 3D 35 10 1Q 19
Do you know how hot your computer is running at home? I do
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top