Solved

Handling Data's in the ASP File in InterDEV

Posted on 2000-02-29
12
252 Views
Last Modified: 2010-05-02
I have 2 ASP Files like the foloowing
1-Area.Asp - Area_Code, Area_Name
2-Location.Asp - Loca_Code, Loca_Name

I want to Display the Area Table Records by HREF link in the Area.Asp
Once i click the Href link for area, that should open Location.Asp to display the location for corresponding Area.

  I have link between Area and Location by Area_Code Field.
 
This i would like to know by using Visual Basin InterDev.
0
Comment
Question by:thangaraj
  • 6
  • 5
12 Comments
 
LVL 13

Expert Comment

by:crazyman
ID: 2569541
you can pass the the area clicked using the ? symobol eg.

<a href="location.asp?Area=NewYork>New York</a>

then in the location.asp file you can retrieve this using


<%=request.querystring("Area"%>

this will give you the passed data..


HTH
0
 
LVL 13

Expert Comment

by:crazyman
ID: 2569550
If you show me some code i can give you a working example
0
 
LVL 13

Expert Comment

by:crazyman
ID: 2569567
If you show me some code i can give you a working example
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:thangaraj
ID: 2571597
I am using Connection, Recordset Object to display the data . In Area Table (Area.asp) i have two fields like AREA_CODE, AREA_NAME. That i have linked with AreaRst RecordSet Control.

Here I want to display the Area_Code and Area_Name. I need to make Href for Area_Name. Once I Click the Area_Name that should open the Location.ASP with Corresponding location where already i have link between Area.Area_Code = Location.Location.Code.

Ques1 - How Can i display the Fields like Area_Code, Area_Name by Href

Ques2 - Is it possible to hide the Area_Code from Display, It means only i want to display Area_Name, But the link should takes place.

Ques3 - How can i pass the parameter Query for Location.Asp.
Ex : Select Location_Code, Location_name From Location Where Area_Code = (Result From Clicking Href from Area.Asp)


<a href="location.asp?Area=NewYork>New York</a>

Here i want to display the fields Area_Code from AreaRst RecordSet Control. How ?. Because I know how to make Href link for Text. But I want to know to display the Records from Recordset Control
0
 
LVL 13

Accepted Solution

by:
crazyman earned 200 total points
ID: 2571980
ok presuming rsArea is the name of your record set


<% do while not rsArea.eof
%>
<a href="location.asp?Area=<%=rsArea.fields("Area_Name")%>&Code=<%=rsArea.fields("Area_Code")%>"><%=rsArea.fields("Area_Name")%></a><br>
<%rsArea.movenext
loop%>


that should give all the appropriate href's... passing the Area and Code parameter on the appropriate links.


then place this in location.asp.

<%=request.querystring("Area")%>
<%=request.querystring("Code")%>

it should show the passed values.

as for the SQl

"Select Location_Code, Location_name From Location Where Area_Code ='" & request.querystring("Code") & "'"

0
 

Author Comment

by:thangaraj
ID: 2572120
Thanks for Ur ans. I am sorry for u. I am new to InterDEV. So I want to know how to call this Loop Condition. Because I want to make it display while the page loading.

I have Recordset Control AREARST in Area.Asp. So Where should I call this loop what u have answered ?. (Like Onload, etc)

And also where should i call the following codes in the Location.Asp

<%=request.querystring("Area")%>
<%=request.querystring("Code")%>
"Select Location_Code, Location_name From Location Where Area_Code ='" & request.querystring("Code") & "'"

0
 
LVL 13

Expert Comment

by:crazyman
ID: 2572238
you can call the loop after you have populated the record set and wish to display the links.
If you wish for the output to display as it loads put this at the top of your page.

<%response.buffer=false%>


you can place
<%=request.querystring("Area")%>
<%=request.querystring("Code")%>

anywhere in your page this is just to print out the values passed to the page so you will want to remove these when you verify that the values are the same as the Href you clicked on.



The last bit was an answer to Q3.

Ques3 - How can i pass the parameter Query for Location.Asp.
                           Ex : Select Location_Code, Location_name From Location Where Area_Code = (Result From Clicking Href from Area.Asp)

Answer="Select Location_Code, Location_name From Location Where Area_Code ='" & request.querystring("Code") & "'"


This is the SQl that you should pass when you open the record set.

If your still not sure you can post the pages and i can show you where to place them.



Cheers.




0
 

Author Comment

by:thangaraj
ID: 2572359
Sir, I have the Following
1. SalesCNN = Connection Object -
   By Using ADD Connection Object
2. AreaRst = DesignTime RecordSetControl
   
So, I don't have anymore code in the Area.Asp except the following

So, I want to display those AreaRst Designtime Control Recordset (Named AreaRst) in the Area.Asp.  How ?

Tell me the way to make connection, recordset object by coding instead of using design time controls



=================

<%@ Language=VBScript %>
<% ' VI 6.0 Scripting Object Model Enabled %>
<!--#include file="_ScriptLibrary/pm.asp"-->
<% if StartPageProcessing() Then Response.End() %>
<FORM name=thisForm METHOD=post>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">

</HEAD>
<BODY>


<P>
<!--METADATA TYPE="DesignerControl" startspan
<OBJECT classid="clsid:9CF5D7C2-EC10-11D0-9862-0000F8027CA0" id=Recordset1><PARAM NAME="ExtentX" VALUE="12197"><PARAM NAME="ExtentY" VALUE="2090"><PARAM NAME="State" VALUE="(TCConn=\qSalesCNN\q,TCDBObject=\qTables\q,TCDBObjectName=\qArea\q,TCControlID_Unmatched=\qRecordset1\q,TCPPConn=\qSalesCNN\q,RCDBObject=\qRCDBObject\q,TCPPDBObject=\qTables\q,TCPPDBObjectName=\qArea\q,TCCursorType=\q3\s-\sStatic\q,TCCursorLocation=\q3\s-\sUse\sclient-side\scursors\q,TCLockType=\q4\s-\sBatch\sOptimistic\q,TCCacheSize_Unmatched=\q10\q,TCCommTimeout_Unmatched=\q10\q,CCPrepared=0,CCAllRecords=1,TCNRecords_Unmatched=\q10\q,TCODBCSyntax_Unmatched=\q\q,TCHTargetPlatform=\q\q,TCHTargetBrowser_Unmatched=\qServer\s(ASP)\q,TCTargetPlatform=\qInherit\sfrom\spage\q,RCCache=\qRCBookPage\q,CCOpen=1,GCParameters=(Rows=0))"></OBJECT>
-->
<!--#INCLUDE FILE="_ScriptLibrary/Recordset.ASP"-->
<SCRIPT LANGUAGE="JavaScript" RUNAT="server">
function _initRecordset1()
{
      var DBConn = Server.CreateObject('ADODB.Connection');
      DBConn.ConnectionTimeout = Application('SalesCNN_ConnectionTimeout');
      DBConn.CommandTimeout = Application('SalesCNN_CommandTimeout');
      DBConn.CursorLocation = Application('SalesCNN_CursorLocation');
      DBConn.Open(Application('SalesCNN_ConnectionString'), Application('SalesCNN_RuntimeUserName'), Application('SalesCNN_RuntimePassword'));
      var cmdTmp = Server.CreateObject('ADODB.Command');
      var rsTmp = Server.CreateObject('ADODB.Recordset');
      cmdTmp.ActiveConnection = DBConn;
      rsTmp.Source = cmdTmp;
      cmdTmp.CommandType = 2;
      cmdTmp.CommandTimeout = 10;
      cmdTmp.CommandText = '"Area"';
      rsTmp.CacheSize = 10;
      rsTmp.CursorType = 3;
      rsTmp.CursorLocation = 3;
      rsTmp.LockType = 4;
      Recordset1.setRecordSource(rsTmp);
      Recordset1.open();
      if (thisPage.getState('pb_Recordset1') != null)
            Recordset1.setBookmark(thisPage.getState('pb_Recordset1'));
}
function _Recordset1_ctor()
{
      CreateRecordset('Recordset1', _initRecordset1, null);
}
function _Recordset1_dtor()
{
      Recordset1._preserveState();
      thisPage.setState('pb_Recordset1', Recordset1.getBookmark());
}
</SCRIPT>

<!--METADATA TYPE="DesignerControl" endspan-->
</P>

</BODY>
<% ' VI 6.0 Scripting Object Model Enabled %>
<% EndPageProcessing() %>
</FORM>
</HTML>










0
 

Author Comment

by:thangaraj
ID: 2572409
Without Adding Connection Object, Recordset Object,
Can I use Connection, Recordset object by using Adding ADO 2.0 Library in the Project Reference.

How can i add code for creating Connection and Recordset object
0
 

Expert Comment

by:EasyCoder
ID: 2572483
Aha you are doing this in server side Java Script when i had assumed that you were using VBScript for server side proccess.
0
 

Author Comment

by:thangaraj
ID: 2572484
Can U check my another question ?
"Working with DHTML"
0
 

Author Comment

by:thangaraj
ID: 2572545
VB Script Code for both Server & Client

<%@ Language=VBScript %>
<% ' VI 6.0 Scripting Object Model Enabled %>
<!--#include file="_ScriptLibrary/pm.asp"-->
<% if StartPageProcessing() Then Response.End() %>
<FORM name=thisForm METHOD=post>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">

</HEAD>
<BODY>
<P>&nbsp;
</P>
<P><A href="http://kumar/Project3_Local/Location.asp">Test</A></P>
<P>
<!--METADATA TYPE="DesignerControl" startspan
<OBJECT classid="clsid:9CF5D7C2-EC10-11D0-9862-0000F8027CA0" id=AreaRst style="LEFT: 0px; TOP: 0px">
      <PARAM NAME="ExtentX" VALUE="12197">
      <PARAM NAME="ExtentY" VALUE="2090">
      <PARAM NAME="State" VALUE="(TCConn=\qSalesCNN\q,TCDBObject=\qTables\q,TCDBObjectName=\qArea\q,TCControlID_Unmatched=\qAreaRst\q,TCPPConn=\qSalesCNN\q,RCDBObject=\qRCDBObject\q,TCPPDBObject=\qTables\q,TCPPDBObjectName=\qArea\q,TCCursorType=\q3\s-\sStatic\q,TCCursorLocation=\q3\s-\sUse\sclient-side\scursors\q,TCLockType=\q4\s-\sBatch\sOptimistic\q,TCCacheSize_Unmatched=\q10\q,TCCommTimeout_Unmatched=\q10\q,CCPrepared=0,CCAllRecords=1,TCNRecords_Unmatched=\q10\q,TCODBCSyntax_Unmatched=\q\q,TCHTargetPlatform=\q\q,TCHTargetBrowser_Unmatched=\qServer\s(ASP)\q,TCTargetPlatform=\qServer\s(ASP)\q,RCCache=\qRCBookPage\q,CCOpen=1,GCParameters=(Rows=0))"></OBJECT>
-->
<!--#INCLUDE FILE="_ScriptLibrary/Recordset.ASP"-->
<SCRIPT LANGUAGE="JavaScript" RUNAT="server">
function _initAreaRst()
{
      var DBConn = Server.CreateObject('ADODB.Connection');
      DBConn.ConnectionTimeout = Application('SalesCNN_ConnectionTimeout');
      DBConn.CommandTimeout = Application('SalesCNN_CommandTimeout');
      DBConn.CursorLocation = Application('SalesCNN_CursorLocation');
      DBConn.Open(Application('SalesCNN_ConnectionString'), Application('SalesCNN_RuntimeUserName'), Application('SalesCNN_RuntimePassword'));
      var cmdTmp = Server.CreateObject('ADODB.Command');
      var rsTmp = Server.CreateObject('ADODB.Recordset');
      cmdTmp.ActiveConnection = DBConn;
      rsTmp.Source = cmdTmp;
      cmdTmp.CommandType = 2;
      cmdTmp.CommandTimeout = 10;
      cmdTmp.CommandText = '"Area"';
      rsTmp.CacheSize = 10;
      rsTmp.CursorType = 3;
      rsTmp.CursorLocation = 3;
      rsTmp.LockType = 4;
      AreaRst.setRecordSource(rsTmp);
      AreaRst.open();
      if (thisPage.getState('pb_AreaRst') != null)
            AreaRst.setBookmark(thisPage.getState('pb_AreaRst'));
}
function _AreaRst_ctor()
{
      CreateRecordset('AreaRst', _initAreaRst, null);
}
function _AreaRst_dtor()
{
      AreaRst._preserveState();
      thisPage.setState('pb_AreaRst', AreaRst.getBookmark());
}
</SCRIPT>

<!--METADATA TYPE="DesignerControl" endspan-->
</P>


</BODY>
<% ' VI 6.0 Scripting Object Model Enabled %>
<% EndPageProcessing() %>
</FORM>
</HTML>
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
message box in access 4 52
Copy a row 12 69
Added a column screws up code 5 69
Macro to copy formulas to the column direcly to the right and maintain the same range. 2 26
There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question