•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP section within the Web Development category of DaniWeb, a massive community of 391,940 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,865 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP advertiser: Lunarpages ASP Web Hosting
Views: 1543 | Replies: 4 | Solved
![]() |
Anyone have a clue what I am doing wrong here?
I have tried to call this function a bunch of different ways, but here is the latest:
mProfitPercent = GetProfitPercent
Here is the function that I am trying to call:
Here is the exact error I am getting:
Microsoft VBScript runtime error '800a01a8'
Object required
It errors on an Execute statement...
Thanks!
I have tried to call this function a bunch of different ways, but here is the latest:
mProfitPercent = GetProfitPercent
Here is the function that I am trying to call:
asp Syntax (Toggle Plain Text)
Function GetProfitPercent Dim rsRegx Set rsRegx = Nothing 'Set rsReg = ActiveConnection sSQL="SELECT PROFIT_PERCENT FROM t_DIRECTORY WHERE directory_id = '" & Session("UserLocationId") & "'" set rsRegx = server.CreateObject("adodb.recordset") rsRegx.cursorlocation = aduseclient rsRegx.cursortype = adkeyset rsRegx.open sSQL, gobjConnect if not rsRegx.eof then Session("PPercent") = rsRegx("PROFIT_PERCENT") & "" else Session("PPercent") = ".15" end if rsRegx.Close Set rsRegx = Nothing CloseDbConn End Function
Here is the exact error I am getting:
Microsoft VBScript runtime error '800a01a8'
Object required
It errors on an Execute statement...
Thanks!
•
•
Join Date: Sep 2007
Posts: 1,054
Reputation:
Rep Power: 3
Solved Threads: 61
It is telling you that "Session("UserLocationId")" is not an object, it is not set. Check to make sure it is spelled correctly, and if the ID is an integer field in the database, remove the single quotes in the sSQL statement.
Or that gobjConnect does not exist, or rsRegx is not set (which above it is). But where is gobjConnect??
Or that gobjConnect does not exist, or rsRegx is not set (which above it is). But where is gobjConnect??
Last edited by SheSaidImaPregy : Feb 4th, 2008 at 9:49 am.
After messing around with it and hardcoding some numbers in and it looks like it is not getting the value out of this:
If I replace reRegx("PROFIT_PERCENT") with ".12" it works just fine. I cannot figure out why it is not pulling the Profit_Percent value out of the DB. Any ideas?
asp Syntax (Toggle Plain Text)
Session("PPercent") = rsRegx("PROFIT_PERCENT") & ""
If I replace reRegx("PROFIT_PERCENT") with ".12" it works just fine. I cannot figure out why it is not pulling the Profit_Percent value out of the DB. Any ideas?
•
•
Join Date: Sep 2007
Posts: 1,054
Reputation:
Rep Power: 3
Solved Threads: 61
Do you have a correct match, you have records? Do a count of records returned.
remove the last ' & "" ' bit from the end, there is no need for it.
Also, every column in a database is case-sensitive. Make sure that i is "PROFIT_PERCENT" and not "Profit_Percent", you know? Verify the spelling and cases.
remove the last ' & "" ' bit from the end, there is no need for it.
Also, every column in a database is case-sensitive. Make sure that i is "PROFIT_PERCENT" and not "Profit_Percent", you know? Verify the spelling and cases.
Here is what I ended up with... I ended up creating another connection instead of calling another function that should have opened the connection (it works on a few other functions).
Thanks for the help.
asp Syntax (Toggle Plain Text)
Function GetProfitPercent Dim rsReg Dim value 'OpenDbConn - did not work for me this time for whatever reason. This is what called the function that Conn does now. Set rsReg = Nothing set Conn = Server.CreateObject("ADODB.Connection") Conn.Open gsConnect 'Set rsReg = ActiveConnection sSQL="SELECT PROFIT_PERCENT FROM Table WHERE directory_id = '" & Session("UserLocationId") & "'" set rsReg = server.CreateObject("adodb.recordset") rsReg.cursorlocation = aduseclient rsReg.cursortype = adkeyset rsReg.open sSQL, Conn if not rsReg.eof then Session("PPercent") = rsReg("PROFIT_PERCENT") & "" value = Session("PPercent") else Session("PPercent") = ".15" value = Session("PPercent") end if rsReg.Close Set rsReg = Nothing GetProfitPercent = value End Function
Thanks for the help.
Last edited by rrocket : Feb 5th, 2008 at 4:34 pm.
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb ASP Marketplace
- Compile Error: Object Required (Visual Basic 4 / 5 / 6)
- javascript - object required error (JavaScript / DHTML / AJAX)
- VB6 - Outlook Email set up - Error 424: Object required (Visual Basic 4 / 5 / 6)
- Error 424-object required (Visual Basic 4 / 5 / 6)
- VB6 RTE '424' Object required. (Visual Basic 4 / 5 / 6)
- internet explorer script error (Windows 9x / Me)
- Runtime Error 424 object required (was: Please Help!) (Visual Basic 4 / 5 / 6)
Other Threads in the ASP Forum
- Previous Thread: AutoEventwireup
- Next Thread: Chilisoft ASP script for my church - I need help



Linear Mode