Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

ASP.NET Forum


You are currently viewing our ASP.NET Forum as a guest. Please register to participate.
Login



Reply
Retrieve Data from Previous Form
Old 07-30-2006, 10:44 PM Retrieve Data from Previous Form
Junior Talker

Posts: 2
Name: Renuga
Trades: 0
hii...sorry,but ive a basic ques to ask since im new to ASP.I've got a prob of pulling my data and retrieving data from 1form to the next form.Is there anything wrong with my SQLexecution syntax.It seems like its pulling the data and wrong info when i click on the specific link...anyone can help me??
Ive attached3 forms.....from custoder to custorderview and finally edit form.Problem starts form the custorderview page as i cant pull the correct exe no when the edit button is clicked under the order delivery table of the ASP pg.Then when the modify/alter button is clicked,these datas doesnt appear at the next form at all.Sorry cant attach my files
Thanxs a lot.

Edit form
----------------------------------------------------

<!-- #include file="i_utils.asp" -->
<%
'Variables
Dim ExecNo
Dim Destination
Dim TransMode
Dim Month
Dim Year
Dim PalletSize
Dim DeliveryQty
Dim NoOfPallets
Dim Priority
Dim blnWhere
Dim sql_a
Dim OD_ExecNo
Dim OD_Destination
Dim OD_TransMode
Dim OD_Month
Dim OD_Year
Dim OD_PalletSize
Dim OD_DeliveryQty
Dim OD_NoOfPallets
Dim OD_Priority

'Set/initialize variables
End Sub
'db_select_view_custorder

%>
<%
function getDestination(m_sql, m_selected)
dim rsDestination, mTemp, mSelected

'Set rsBatt = Server.CreateObject("ADODB.Recordset")
'rsBatt.Open p_sql, cn, 1, 3 'either one
set rsDestination= cn.execute(sql)

while not rsDestination.EOF
if Trim(rsDestination("Destination")) = Trim(m_selected) then mSelected = "selected "
mTemp = mTemp & "<option " & mSelected & rsDestination("Destination") & ">" & _
rsDestination("Destination") & " </option>" & vbCrLf
mSelected = ""
rsDestination.MoveNext
wend
getDestination = mTemp
set rsDestination = nothing
end Function
%>
<LINK title=form href="default.css" type=text/css rel=stylesheet>
<a href='custorder.asp' class="headers1">&nbsp;<b><center>Customer Order Edit Form
</b>&nbsp;</a>
<HR>

<table>
<form id="search" name="search" action="edit.asp" method="post" >
<tr>
<td class='labelTD'>Execution No</td>
<td class='dataTD'>
<input type=text name="ExecNo" size="" maxlength="" value="">
</td>
</tr>
<tr>
<td class='labelTD'>Month</td>
<td class='dataTD'>
<input type=text name="Month" size="" maxlength="" value="">
</td>
</tr>
<tr>
<td class='labelTD'>Year</td>
<td class='dataTD'>
<input type=text name="Year" size="" maxlength="" value="">
</td>
</tr>
<tr>
<%sql = "SELECT * FROM Destination"%>
<td class='labelTD'>Destination</td>
<td class='dataTD'>
<select name="Destination" align="left">
<option value=""></option>
<%=getDestination(sql, Destination)%>
</select>
</td>
</tr>
<tr>
<td class='labelTD'>Transport Mode</td>
<td class='dataTD'>
<input type=text name="TransMode" size="1" maxlength="2" value="">
</td>
</tr>
<tr>
<td class='labelTD'>Pallet Size</td>
<td class='dataTD'>
<input type=text name="Pallet Size" size="4" maxlength="4" value="">
</td>
</tr>
<tr>
<td class='labelTD'>No of Pallets</td>
<td class='dataTD'>
<input type=text name="No of Pallets" size="4" maxlength="4" value="">
</td>
</tr>
<tr>
<td class='labelTD'>Priority</td>
<td class='dataTD'>
<input type=text name="Priority" size="4" maxlength="4" value="">
</td>
</tr>
<tr>
<td class='labelTD'>Delivery Qty</td>
<td class='dataTD'>
<input type=text name="DeliveryQty" size="4" maxlength="4" value="">
</td>
</tr>
<tr>
<td class='labelTD'>Remarks</td>
<td class='dataTD'>
<input type=text name="Remarks" size="4" maxlength="4" value="">
</td>
</tr>
<tr>
<td class='labelTD'></td>
<td class='dataTD'>

<input class='cmd' type='submit' value='Search' id='submit' name='submit'><input type=hidden name="search" value="1">
<input class='cmd' type='reset' value='Clear' id='Reset' name='Reset'>
<input class='cmd' type="button" value="Add Record" id='Reset' name="action" onclick="self.location='custorderadd.asp'">

</td>
</tr>
</table>

<table border=0 cellspacing=0 cellpadding=8 class="tclass" background="gif/line.gif" width=100%>

<tr align="left"><td><table border=0 cellspacing=0 cellpadding=0>
<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;


</table></td></tr>

<%
page_no = request("page_no")
if page_no = "" then page_no = 1
if sql_a <> "" then
cmd.CommandText = sql_a
rs.Filter = ""
rs.CursorLocation = 3
rs.CacheSize = 5
rs.Open cmd
if not rs.EOF then
rs.MoveFirst
rs.PageSize = 30
max_count = cInt(rs.PageCount)
num_recs = rs.RecordCount
rs.AbsolutePage = page_no
results = true
else
results = false
rs.Close
end if
else
results = false
end if
rec_count = 0
%>
<%
if results = true then
%>
<table>
<form id="view_custorder" name="view_custorder" action="" method="get" >
<tr>
<td class='fieldT1'></td>
<td class='fieldT1'><a href="<% =request.servervariables("script_name") %>?<% =request_string %>page_no=<% =page_no %>&sortby=ExecNo" class=fieldFont title="">Exec No</a></td>
<td class='fieldT1'><a href="<% =request.servervariables("script_name") %>?<% =request_string %>page_no=<% =page_no %>&sortby=Month" class=fieldFont title="">Month</a></td>
<td class='fieldT1'><a href="<% =request.servervariables("script_name") %>?<% =request_string %>page_no=<% =page_no %>&sortby=Year" class=fieldFont title="">Year</a></td>
<td class='fieldT1'><a href="<% =request.servervariables("script_name") %>?<% =request_string %>page_no=<% =page_no %>&sortby=Destination" class=fieldFont title="">Destination</a></td>
<td class='fieldT1'><a href="<% =request.servervariables("script_name") %>?<% =request_string %>page_no=<% =page_no %>&sortby=TransportMode" class=fieldFont title="">TransportMode</a></td>
<td class='fieldT1'><a href="<% =request.servervariables("script_name") %>?<% =request_string %>page_no=<% =page_no %>&sortby=PalletSize" class=fieldFont title="">PalletSize</a></td>
<td class='fieldT1'><a href="<% =request.servervariables("script_name") %>?<% =request_string %>page_no=<% =page_no %>&sortby=No of Pallets" class=fieldFont title="">No of Pallets</a></td>
<td class='fieldT1'><a href="<% =request.servervariables("script_name") %>?<% =request_string %>page_no=<% =page_no %>&sortby=Priority" class=fieldFont title="">Priority</a></td>
<td class='fieldT1'><a href="<% =request.servervariables("script_name") %>?<% =request_string %>page_no=<% =page_no %>&sortby=Delivery Qty" class=fieldFont title="">Delivery Qty</a></td>
<td class='fieldT1'><a href="<% =request.servervariables("script_name") %>?<% =request_string %>page_no=<% =page_no %>&sortby=Remarks" class=fieldFont title="">Remarks</a></td>
</tr>
<%
do while not rs.EOF AND (rec_count < rs.Pagesize)
':: read db record
on error resume next
edit_link = rs("edit_link")
ExecNo = rs("ExecNo")
Month= rs("Month")
Year = rs("Year")
Destination = rs("Destination")
TransportMode = rs("TransportMode")
PalletSize = rs("PalletSize")
No of Pallets = rs("No of Pallets")
Priority = rs("Priority")
Delivery Qty = rs("Delivery Qty")
Remarks = rs("Remarks")
on error goto 0
%>
<tr>
<td class='dataTD' >
[ <a href='custorder_view.asp?ExecNo=<% =ExecNo %>&Month=<% =Month %>&Year=<% =Year %>&Destination=<% =Destination %>&TransportMode=<% =TransportMode %>&PalletSize=<% =PalletSize%>&No Of Pallets=<% =No Of Pallets%>&Priority=<% =Priority%>&DeliveryQty=<% =DeliveryQty %>&Remarks=<% =Remarks %>' class=dataFont>View</a> ]<% =edit_link %>
</td>

<td class='dataTD' >
<% =ExecNo %>
</td>
<td class='dataTD' >
<% =Month %>
</td>
<td class='dataTD' >
<% =Year %>
</td>
<td class='dataTD' >
<% =Destination %>
</td>
<td class='dataTD' >
<% =TransportMode%>
</td>

<td class='dataTD' >
<% =Pallet Size %>
</td>
<td class='dataTD' >
<% =No Of Pallets %>
</td>
<td class='dataTD' >
<% =Priority %>
</td>
<td class='dataTD' >
<% =DeliveryQty %>
</td>
<td class='dataTD' >
<% =Remarks %>
</td>
</tr>
<%
rs.MoveNext
rec_count = rec_count + 1
loop
rs.Close
%>
</form>
</table>
<%
else
%>
no matches were found.
<%
end if
%>
<%
if max_count > 1 then
%>
<!-- paging footer -->
<TABLE class=HeaderTable >
<tr>
<td width="20%" class=HeaderTD>
<% if page_no > 1 then %>
<a class=HeaderFont href="<% =request.servervariables("script_name") %>?<% =request_string %>page_no=<% =page_no-1 %>&sortby=<% =request("sortby") %>">Prev</a>
<% else %> <% end if %> </td>
<td align=center class=HeaderTD>
Page&nbsp;
<% for i = 1 to max_count %>
<% if i = cint(page_no) then %>
<b><%=i%></b>
<% else %>
<a class=HeaderFont href="<% =request.servervariables("script_name") %>?<% =request_string %>page_no=<% =i %>&sortby=<% =request("sortby") %>&ExecNo= " & to_sql(ExecNo, "text")&PO_No= " & to_sql(PO_No, "text")&CustCode= " & to_sql(CustCode, "text")&Model= " & to_sql(Model, "text") &Month= " & to_sql(Month, "text")&Year= " & to_sql(Year, "text")%><%=i%></a>
<% end if %>
<%next %>
</td>
<td align=right width="20%" class=HeaderTD>
<% if cInt(page_no) < cInt(max_count) then %>
<a class=HeaderFont href="<% =request.servervariables("script_name") %>?<% =request_string %>page_no=<% =page_no+1 %>&sortby=<% =request("sortby") %>">Next</a>
<% end if %>
</td>
</tr>
</TABLE>
<% end if %>
<%
':: assure that any db resources are freed
on error resume next
rs.Close
set rs = NOTHING
cn.Close
set cn = NOTHING
on error goto 0
%>
Renuga is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Reply     « Reply to Retrieve Data from Previous Form
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.11187 seconds with 12 queries