Last post Oct 11, 2011 03:02 AM by Meridius750
Oct 10, 2011 08:53 AM|Meridius750|LINK
Hello,First time poster and new to ASP programming.I have a functional database to where i am trying to add new functionality.I'm trying to add the idea to check if a returned string is empty, if so get value from a backup table which
holds historical information. I've tried a lot of different things now and a full day of google didn't help
me figure it out.Here is what i have got for the specific part:
SqlJunk = "SELECT * FROM CMDBtable"
~~some search options with WHERE statements~~
Set rsGlobalWeb = Server.CreateObject("ADODB.Recordset")
rsGlobalWeb.Open SqlJunk, dbGlobalWeb, 3
<% If rsGlobalWeb("Serial") <> "" Then
response.write("<td>" & rsGlobalWeb("Serial") & "</td>")
SqlBackup = "SELECT * FROM CMDBbackup WHERE Naam_Cattools = '" & rsGlobalWeb("SNMP_Custom_2") & "'"
Set rsBackup = Server.CreateObject("ADODB.Recordset")
rsBackup.Open SqlBackup, dbGlobalWeb, 3
If rsBackup("Serial") <> "" Then
response.write("<td>" & rsBackup("Serial") & " (backup)</td>")
response.write("<td>No historical data found</td>")
The problem is: once it comes across missing information it stops there instead of
showing the "No historical data".
Error message i get is: error '80020009' /i-base/Searchresults.asp, line 47...
line with: If rsBackup("Serial") <> "" ThenIs there something i missed due to inexperience or any idea's what it could be?Thanks in advanceErik
Oct 10, 2011 03:36 PM|atconway|LINK
This is an ASP.NET forums site which is different from Classic 'ASP' programming and is not supported in this forum. Try the following forum which will help you:
ASP VB Forums:
With this I will say you might want to check if the Recordset has any value 1st before accessing its fields, and then making sure a field is not null too:
'Check to see if any records exist:
If Not rsBackup.EOF Then
If Not IsNull(rsBackup("Serial")) And (rsBackup("Serial") <> "") Then
Oct 11, 2011 03:02 AM|Meridius750|LINK
Thanks for the reply. I'll post it on that forum the next time i have an issue.
For this time you solved my problem! Thanks a million.
I just pasted in the code, added the response.write and it works!