Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 7th, 2003, 01:34 AM
Friend of Wrox
Points: 2,376, Level: 20
Points: 2,376, Level: 20 Points: 2,376, Level: 20 Points: 2,376, Level: 20
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , , Australia.
Posts: 596
Thanks: 1
Thanked 3 Times in 3 Posts
Default

Your variable rs is a recordset, you need to declare that as a recordset and and then assign the returning recordset from the connection.

BUT this requires that you have set up a connection?
If you have set up the connection earlier on the page then you code to execute the select statement should look something like this.

<%
dim newarr,tem, rs

'From before
newarr = split(a,",")

for i=0 to Ubound(newarr)
'Execute the SQL query
set rs = connection.execute "select * from key_word where key_words='"&newarr(i)&"'
'Assign the recordset field value to tem
tem=rs("key_word_id
'Do something with tem
response.write(tem & "<BR>")
next
%>

I don't mean to discourage you but I think you may need a little more background information on databases and asp. You should do a search on google for ASP DATABSE CONNECTIONS and do a little reading.

I am more than happy to help you but you must understand the fundamental theory before being able to write the code.

Depending on you database have a look at these for starters
http://www.4guysfromrolla.com/webtech/042599-1.shtml
http://www.aspfree.com/articles/2036,1/articles.aspx
http://www.codefixer.com/tutorials/databases.asp
http://www.codefixer.com/tutorials/



======================================
They say, best men are moulded out of faults,
And, for the most, become much more the better
For being a little bad.
======================================
 
Old November 7th, 2003, 02:32 AM
Authorized User
 
Join Date: Sep 2003
Location: islamabad, pk, Pakistan.
Posts: 72
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to zaeem Send a message via Yahoo to zaeem
Default

Hello rodmcleay thanx for ur quick reply. Friend I have already taken the suggested steps like that
<%dim con,rs
setcon=server.createobject("ADODB.Connection")
set rts=server.createobject("ADODB.Recordset")
con.ops"DSN Name","UID=""","PWD=""
%>
I have completed the steps but the error is same at the same place.
Please help me.

Zaeem Sherazi
 
Old November 8th, 2003, 12:28 AM
Authorized User
 
Join Date: Sep 2003
Location: islamabad, pk, Pakistan.
Posts: 72
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to zaeem Send a message via Yahoo to zaeem
Default

Hello rodmcleay I have misplaced ur e mail in which u have mentioned ur Personal Email Address. so I am writtinf over here I hope u don't mind. The split fuction works fine but when I use it in this fasion(Code is given below) it gives me error that Type mismatch.
The ASP Code starts from Line no149 to line 168.
I Hope you will help me.
================================================== ====


<html>

<head>


<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">

<title>Maju Library</title>



<link href="Style%20Sheets/style.css" rel="stylesheet" type="text/css">
</head>

<body topmargin="0" leftmargin="0" bgcolor="#3E4886" link="#717BB9" vlink="#717BB9" alink="#303A78">

<div align="center">
  <center>
  <table border="0" cellpadding="0" cellspacing="0" width="100%" background="images/gray_07.gif">
    <tr>
        <td width="27%"> <img src="images/maju.gif" width="166" height="70"><br>
        <img src="images/gray_09.gif" width=207 height=24> </td>
        <td width="69%"> <IMG src="images/gray_04.gif" width=90 height=94><IMG src="images/gray_04.gif" width=90 height=94><IMG src="images/gray_04.gif" width=90 height=94><IMG src="images/gray_04.gif" width=90 height=94><IMG src="images/gray_06.gif" width=6 height=94></td>
      <td width="4%" background="images/gray_07.gif">&nbsp;</td>
    </tr>
  </table>
  </center>
</div>
<div align="center">
  <center>
  <table border="0" cellpadding="0" cellspacing="0" width="100%">
    <tr>
      <td width="100%">
            <IMG src="images/gray_10.gif" width=600 height=3></td>
    </tr>
  </table>
  </center>
</div>
<div align="center">
  <center>
  <table border="0" cellpadding="0" cellspacing="0" width="100%">
    <tr>
      <td width="11%" valign="top">
      <div align="center">
        <center>
              <table border="0" cellpadding="0" cellspacing="0" width="100%">
                <tr>
                  <td width="100%"><a href="borrowingcategory.asp"><img src="images/bcategory.gif" width="144" height="26" border="0"></a></td>
                </tr>
                <tr>
                  <td width="100%"> <a href="images/bcategory.gif"> </a><a href="msearch.asp"><img src="images/smember.gif" width=144 height=26 border="0"></a></td>
                </tr>
                <tr>
                  <td width="100%"> <a href="jsearch.asp"> <IMG src="images/sjournal.gif" width=144 height=26 border="0"></a></td>
                </tr>
                <tr>
                  <td width="100%"> <a href="bsearch.asp"> <IMG src="images/sbook.gif" width=144 height=26 border="0"></a></td>
                </tr>
                <tr>
                  <td width="100%"> <a href="images/issuebook.gif"> </a><a href="bookissue.asp"><img src="images/issuebook.gif" width="144" height="26" border="0"></a></td>
                </tr>
                <tr>
                  <td height="26"><a href="deletereservation.asp"><img src="images/reservationdelete.jpg" width="144" height="26" border="0"></a></td>
                </tr>
                <tr>
                  <td width="100%" height="26"><a href="return.asp"><img src="images/return.gif" width="144" height="26" border="0"></a>
                  </td>
                </tr>
                <tr>
                  <td width="100%"> <a href="http://www.thehotweb.net/"> </a><a href="mupdate.asp"><img src="images/umember.gif" width=144 height=26 border="0"></a></td>
                </tr>
                <tr>
                  <td><a href="bupdate.asp"><img src="images/ubook.gif" width="144" height="26" border="0"></a></td>
                </tr>
                <tr>
                  <td><a href="jupdate.asp"><img src="images/ujournal.gif" width="144" height="26" border="0"></a></td>
                </tr>
                <tr>
                  <td><a href="bdelete.asp"><img src="images/bdelete.gif" width="144" height="26" border="0"></a></td>
                </tr>
                <tr>
                  <td><a href="mdelete.asp"><img src="images/mdelete.gif" width="144" height="26" border="0"></a></td>
                </tr>
                <tr>
                  <td><a href="jdelete.asp"><img src="images/jdelete.gif" width="144" height="26" border="0"></a></td>
                </tr>
                <tr>
                  <td><a href="members.asp"><img src="images/members.gif" width="144" height="26" border="0"></a></td>
                </tr>
                <tr>
                  <td><a href="books1.asp"><img src="images/books.gif" width="144" height="26" border="0"></a></td>
                </tr>
                <tr>
                  <td><a href="journal1.asp"><img src="images/journal.gif" width="144" height="26" border="0"></a></td>
                </tr>
                <tr>
                  <td><a href="updatepassword.asp"><img src="images/updatepassword.jpg" width="144" height="26" border="0"></a></td>
                </tr>
                <tr>
                  <td><a href="viewallreservation.asp"><img src="images/viewallreservation.jpg" width="144" height="26" border="0"></a></td>
                </tr>
                <tr>
                  <td>&nbsp;</td>
                </tr>
                <tr>
                  <td><a href="logout.asp"><img src="images/logout.gif" width="144" height="26" border="0"></a></td>
                </tr>
                <tr>
                  <td><img src="images/library.gif" width="144" height="79"></td>
                </tr>
              </table>
              </center>
      </div>
      </td>
      <td width="88%" valign="top">
      <div align="center">
        <center>
        <table width="100%" height="235" border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td width="100%" bgcolor="#000000">
            <div align="center">
              <center>
              <table width="100%" height="383" border="0" cellpadding="3" cellspacing="1">
                <tr>

                            <td width="81%" height="365" bgcolor="#E9EBF3"><table width="42%" border="1" align="center" cellpadding="0" cellspacing="0">
                                <tr>
                                  <td width="65%">Active
                                    Visitors</td>
                                  <td width="35%"><%=application("visitors")%>&nbsp;</td>
                                </tr>
                              </table>
                              <table width="20%" height="131" border="0" align="center" cellpadding="0" cellspacing="0">
                              <tr>
                                  <td><img src="images/logo.jpg" width="170" height="146" align="texttop"></td>
                                </tr>
                            </table>
                              <p>&nbsp;</p>
                              <form name="form1" method="post" action="">
                                <p align="center" class="example">Your
                                  Information Is submitted Successfully
                                </p>
                                <p align="center">
                                  <%


                              dim c,r,f,arr,aryNumbers,q
                               set c=server.CreateObject("adodb.connection")
                              set r=server.CreateObject("adodb.recordset")


                    f=request("keywords")
                    '''F is coming from last page from the "List"
                    '''' F Contains keywords in text seperated by comma
                    '''like asp,begining asp,shaum series
                    response.Write(f)
                    arr=split(f, ",")
                    for i = 0 to UBound(arr)
                    q="select * from key_word where key_word='"&arr(0)&"'"
                    'response.Write(q)&"<BR>"
                    r.open q,c,2,2
                       aryNumbers=r(0).value'''''''''''''''''''''''Error Is Here
                    r.close
                    response.write"KEY WORD ID IS:::::::::::::::::::::::::::::::::::::::::::::::: :::::::::"&(aryNumbers(i) & "<BR>")
            next

            %>
</p>
                                <table width="8%" border="1" align="center" cellpadding="0" cellspacing="0">
                                  <tr>
                                    <td><input name="button" type=button onClick="history.go(-1)" value="Back"></td>

                                  </tr>
                                </table>

                                <p>&nbsp;</p>
                                <p align="center">&nbsp;</p>
                                </form>
                              <p>&nbsp;</p>

                                <p>&nbsp;</p>
                              <p>&nbsp;</p>
                              <p>&nbsp;</p>

                            </td>
                </tr>
              </table>
              </center>
            </div>
            </td>
          </tr>
        </table>
              </center>
      </div>
      </td>
      <td width="1%" valign="top">&nbsp;</td>
    </tr>
  </table>
  </center>
</div>

<div align="center">
  <center>
  <table border="0" cellpadding="0" cellspacing="0" width="100%" background="images/gray_25.gif">
    <tr>
        <td width="32%" background="images/gray_25.gif"> <IMG src="images/gray_21.gif" width=3 height=20><IMG src="images/gray_22.gif" width=141 height=20 border="0"></td>
        <td width="68%" background="images/gray_25.gif"><a href="#"> <IMG src="images/gray_22.gif" width=141 height=20 border="0"></a><IMG src="images/gray_25.gif" width=12 height=20><a href="mailto:zaeemabbas@hotmail.com"><IMG src="images/gray_26.gif" width=94 height=20 border="0"></a></td>
    </tr>
  </table>
  </center>
</div>

</body>

</html>

Zaeem Sherazi
 
Old November 9th, 2003, 09:28 PM
Friend of Wrox
Points: 2,376, Level: 20
Points: 2,376, Level: 20 Points: 2,376, Level: 20 Points: 2,376, Level: 20
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , , Australia.
Posts: 596
Thanks: 1
Thanked 3 Times in 3 Posts
Default

Zaeem,
You need to open the connection c
dim c,r,f,arr,aryNumbers,q
set c=server.CreateObject("adodb.connection")
set r=server.CreateObject("adodb.recordset")
c.open YourConnectionStringOrDSN



======================================
They say, best men are moulded out of faults,
And, for the most, become much more the better
For being a little bad.
======================================
 
Old November 10th, 2003, 12:28 AM
Authorized User
 
Join Date: Sep 2003
Location: islamabad, pk, Pakistan.
Posts: 72
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to zaeem Send a message via Yahoo to zaeem
Default

Hello rodmcleay I have had opend my Connection like that
dim str
str="dsn=tan;uid=sa;pwd=sa;"
c.open str
but It gives me the same error. Please don't mind it and help me to figure it out.
I waiting for ur help.
Bye

Zaeem Sherazi
 
Old November 10th, 2003, 12:32 AM
Friend of Wrox
Points: 2,376, Level: 20
Points: 2,376, Level: 20 Points: 2,376, Level: 20 Points: 2,376, Level: 20
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , , Australia.
Posts: 596
Thanks: 1
Thanked 3 Times in 3 Posts
Default

Can you copy the error message for me

======================================
They say, best men are moulded out of faults,
And, for the most, become much more the better
For being a little bad.
======================================
 
Old November 10th, 2003, 02:05 AM
Authorized User
 
Join Date: Sep 2003
Location: islamabad, pk, Pakistan.
Posts: 72
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to zaeem Send a message via Yahoo to zaeem
Default

Hello Buddy thanks for ur continuous help that u r showing. I am thankful to u for this favore.The Code is as follows;
==================

con.open str
''' Str contains DSN Name Uid and Pwd For sql Server
dim subj,key,arr,newarr,k

    subj=session("subjectheading")
    key=session("keywords")
    arr=split(key,",")
    For i=0 to Ubound(arr)
    k="select * from key_word where key_word='"&arr(i)&"'"
    Response.Write(k)&"<BR>"
    rs.open k,con,2,2
    newarr=rs(0).value''''''''ERROR IS HERE
    'Response.Write(newarr(i))&"<BR>"
    rs.close
    next
=========================
the error is{Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
}, u might think that the record doesn't exist in the database.
But record is actually coming from database in the Combo Box from there I get it and split then.
--------------------
Plesae tell me how I can get the values in "newarr"

Zaeem Sherazi
 
Old November 10th, 2003, 03:02 AM
Friend of Wrox
Points: 2,376, Level: 20
Points: 2,376, Level: 20 Points: 2,376, Level: 20 Points: 2,376, Level: 20
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , , Australia.
Posts: 596
Thanks: 1
Thanked 3 Times in 3 Posts
Default

Zaeem,
Try
k="select * from key_word where key_word='"& trim(arr(i)) &"'"


======================================
They say, best men are moulded out of faults,
And, for the most, become much more the better
For being a little bad.
======================================
 
Old November 10th, 2003, 04:59 AM
Authorized User
 
Join Date: Sep 2003
Location: islamabad, pk, Pakistan.
Posts: 72
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to zaeem Send a message via Yahoo to zaeem
Default

Hello rodmcleay buddy thanx for ur cooperation.
Friend your proposed query worked fine. You Worked like a champ.
You r saviour.
Once again I am thankful to u for this favor.
I hope to get same help from you in the future.
Bye

Zaeem Sherazi




Similar Threads
Thread Thread Starter Forum Replies Last Post
how to find a string in another string in vb6 satish_k VB How-To 3 March 30th, 2007 12:17 PM
Casting String array to string Samatha ASP.NET 1.0 and 1.1 Professional 1 December 5th, 2006 07:46 AM
syntax to find a string in a string cole SQL Server 2000 2 October 10th, 2005 06:06 PM
how to replace a string with another string/number crmpicco Javascript How-To 4 March 14th, 2005 12:59 PM





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