[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 254
  • Last Modified:

display specific excel cells in an html table - ALSO URGENT!!!!!!!!!!!

hi there

well this is the same page that i have my other urgent question based on. the component below is supposed to retrieve these 4 hgihlighted cells which i'l named : Priorities , and it's supposed to display them on the page that has the script in it...called genPri.asp. Now when i run the script i get errors either at :
                          rs.Open sql, cn,3,1
or
                         if rs(3) = "" or isnull(rs(3)) = "True" then
or
                         <td><%=rs(0)%></td>

the entire code snippet is below....now what am i doing wrong? and please ASAP help me out here! oh yeah another alternative would be to have those four cells displayed inside the page...now how would i go about doing that? please this is really urgent...supposed to present this on friday....please any suggestioons and elaboarated examples would be welcomed....THNAKS!

<html>
<head>
<%
  exceldb="PSDSS.xls"

' Create a server connection object
Set cn = Server.CreateObject("ADODB.Connection")
cn.Open "DBQ=" & Server.MapPath(exceldb) & ";" & _
"DRIVER={Microsoft Excel Driver (*.xls)};"


' Create a server recordset object
Set rs = Server.CreateObject("ADODB.Recordset")

' Query to run against the exceldb
' t_request is the name of the
' cell range as defined in excel
sql="select * from Priorities;"

' Execute the sql
rs.Open sql, cn,3,1
%>
<title>Generate Priorities</title>
</HEAD>

<BODY>
<form name="f1" method="post">
<table border="1" width="100%">
        <tr>
        <td width="22%"><P align=center><STRONG>Priority for P1</STRONG></P></td>
      <td width="22%"> <P align=center><STRONG>Priority for P2</STRONG></P></td>
      <td width="22%"> <P align=center><STRONG>Priority for P3</STRONG></P></td>
      <td width="22%"> <P align=center><STRONG>Priority for P4</STRONG></P> </td>
        </tr>

<%
if rs.Eof <> true then
response.write "<table border=1>"
while not rs.Eof
     if rs(3) = "" or isnull(rs(3)) = "True" then
    else
%>
     <tr>
            <td><%=rs(0)%></td>
            <td><%=rs(1)%></td>
             <td><%=rs(2)%></td>
            <td><%=rs(3)%></td>
       </tr>
<%
         
     end if
          rs.MoveNext
     
wend  
end if  
rs.Close
set rs=nothing
cn.Close
  %>
  </table>
  </form>
  </BODY>
  </HTML>
0
NadiaRashid
Asked:
NadiaRashid
  • 7
  • 6
1 Solution
 
Irwin SantosComputer Integration SpecialistCommented:
Ok nadiarashid, I'm here..
we need the exact error....

insert the following into your code.. make sure that they are the FIRST & SECOND lines (place before <html> tag)
<% @ LANGUAGE = VBSCRIPT%>
<% Option Explicit %>

In Internet Explorer..go to TOOLS-INTERNET OPTIONS, ADVANCED tab, look for "SHOW FRIENDLY HTTP ERROR MESSAGES" and make sure  you UNCHECK the box.  Post the exact error message please.

0
 
NadiaRashidAuthor Commented:
morning irwin (if it's morning there)

here's the error i get :

Error Type:
ADODB.Recordset (0x800A0CC1)
Item cannot be found in the collection corresponding to the requested name or ordinal.
/genPri.asp, line 50


where line 50 reads:      if rs(3) = "" or isnull(rs(3)) = "True" then

everything else is in order...all permissions granted...lemme know what u come up with
thanks irwin

nadia
0
 
Irwin SantosComputer Integration SpecialistCommented:
that error says that it has access to the database the field/column name does NOT exist in your database OR it does exist, but you are using and incorrect variable in your coding

is "3" { in rs(3) } a fieldname/column or was the intention to use an array?

if you may consider replacing "3" with an alphanumeric name
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
NadiaRashidAuthor Commented:
the number 3 represents the last of the 4 cells i highlighted and assigned the name "Priorities" to in the excel file i'm calling. i've also tried calling it like this:

         rs("H42")
but it throws exactly the same error on that too

what do you mean alphanumberic name? should i assign a name to each individual cell then? then what about the SQL statment...will it stil be applicable?
0
 
Irwin SantosComputer Integration SpecialistCommented:
nadia...ok screenshot this one...so I can see your worksheet.. upload to the board..
I would like to see your column/field names and part of your data

put it under this link
http://www.ctrlaltdel-usa.net/yabb_2_1_superman/YaBB.pl?board=Services
0
 
NadiaRashidAuthor Commented:
0
 
Irwin SantosComputer Integration SpecialistCommented:
h42 has nothing inside..

perhaps use a static value
0
 
NadiaRashidAuthor Commented:
hey ya
just posted teh exact code...and moved the cells its supposed to call...the concept is...the first VBScript code enters values from the form in the previous page into specific cells...whhich affect all the other cells...and then output the final priorities generated
0
 
NadiaRashidAuthor Commented:
0
 
Irwin SantosComputer Integration SpecialistCommented:
ok...

for now put a static value in I42, what I would like to see is that same value displayed, the line of code below will execute that.

<td><%=rs("I42")%></td>

do you get that same value when you run your code?
0
 
NadiaRashidAuthor Commented:
hi irwin...sorry for the half a day delay....

right so i assigned static values for the cells I42:I45 and i called them, it doesnt actually open the page......this is the error i get:
Error Type:
ADODB.Recordset (0x800A0CC1)
Item cannot be found in the collection corresponding to the requested name or ordinal.
/test/genPri.asp, line 147

where line 147 reads:      if rs("I45") = "" or isnull(rs("I45")) = "True" then    

could it be that i have a conflict because i made 2 independent connections to excel in the same page?hould i consider displaying the cells in some other way? if so you have any suggestions?

thanx
nadia

0
 
NadiaRashidAuthor Commented:
hey ya...well i'm presenting my software today....so i made a make shift arraingement...and i'l work on this later....make shift as in embedding excel into html usgin ifarme...well thankx for ur hekp though!
0
 
Irwin SantosComputer Integration SpecialistCommented:
"could it be that i have a conflict because i made 2 independent connections to excel in the same page?hould i consider displaying the cells in some other way? if so you have any suggestions?"

it is the I45 reference and defining that as a field/column....

Here is a Tutorial for you..

http://www.tutorialized.com/tutorial/Extract-data-from-Excel-Spreadsheet-using-ASP/9684

0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 7
  • 6
Tackle projects and never again get stuck behind a technical roadblock.
Join Now