Solved

Handling Data's in the ASP File in InterDEV

Posted on 2000-02-29
12
243 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
Comment Utility
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
Comment Utility
If you show me some code i can give you a working example
0
 
LVL 13

Expert Comment

by:crazyman
Comment Utility
If you show me some code i can give you a working example
0
 

Author Comment

by:thangaraj
Comment Utility
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
Comment Utility
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
Comment Utility
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 13

Expert Comment

by:crazyman
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Can U check my another question ?
"Working with DHTML"
0
 

Author Comment

by:thangaraj
Comment Utility
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

763 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now