codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  How can I pass values of variables between ASP and WML  rudy at 05:06 on Tuesday, March 02, 2004
 

Hi,

I have created this ASP page, that is supposed to receive some information from a wml form and then add that info into an Access database. I know it works with an html form and it updates the database sucessfully. Once, I replaced the html form with a wml form, it stopped working, and I am getting "system error" in some simulators and "not wml content" in others. It also stopped updating the MS Access database. I am suspecting there is something wrong with passing the values of the variables captured by the wml form to ASP and/or some formatting issues with the asp page.


The wml form page is:

<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//OPENWAVE.COM//DTD WML 1.3//EN" "http://www.openwave.com/dtd/wml13.dtd">

<wml>
<head>
<meta http-equiv="Cache-control" content="max-age=0" forua="true"/>
</head>

<template>

<do type="prev" name="back" label="Back" optional="false">
<prev/>
</do>

<do type="options" name="3" label="Home" optional="false">
<go href="home.wml" sendreferer="false" method="get" enctype="application/x-www-form- urlencoded"/>
</do>

</template>

<card id="Title" title="Title" newcontext="false" ordered="true">
<p align="center" >
<b> Subscribtion Service </b>
</p>
<p align="center" >
<br/>
<fieldset>First Name:
<input type="text" name="FName" maxlength="20" size="20" emptyok="false"/> </fieldset>
<fieldset>Last Name:
<input type="text" name="LName" maxlength="20" size="20" emptyok="false"/> </fieldset>
<fieldset>Mobile Number:
<input type="text" name="MobilePhone" maxlength="20" size="20" emptyok="false"/> </fieldset>
<fieldset>City:
<input type="text" name="City" maxlength="20" size="20" emptyok="false"/> </fieldset>
<fieldset>Country:
<input type="text" name="Country" maxlength="20" size="20" emptyok="false"/> </fieldset>
<fieldset>Secret Word:
<input type="text" name="SecretWord" maxlength="20" size="20" emptyok="false"/> </fieldset>


<do type="accept" label="Subscribe Me">
<go method="post" href="/forum/UpdateDataBase_wml.html">
<postfield name="FName" value="$(FirstNAME)"/>
<postfield name="LName" value="$(LastName)"/>
<postfield name="MobilePhone" value="$(CellPhone)"/>
<postfield name="Country" value="$(State)"/>
<postfield name="City" value="$(Town)"/>
<postfield name="SecretWord" value="$(Pass)"/>
</go>
</do>

</p>
<p align="left">
<br/>
<hr/>

<a href="home.wml">Home </a>

</p>
</card>
</wml>

The ASP Page that this wml form is using to update the MS Access database is:

<%
<% Response.ContentType = "text/vnd.wap.wml" %>
'Dimension variables

Dim adoCon 'Holds the Database Connection Object
Dim rsAddSubscriber 'Holds the recordset for the new record to be added
Dim strSQL1 'Holds the SQL query 1 to query the database
Dim strSQL2 'Holds the SQL query 2 to query the database
Dim rsCheckSubscriber 'Holds the recordset for the record to be checked
Dim MobilePhone 'Holds the Mobile Phone to be checked

'Initialize MobilePhone
MobilePhone = Request.Form("MobilePhone")


'Find out if the Mobile Number already exists
Set adoCon2 = Server.CreateObject("ADODB.Connection")

adoCon2.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("/WAP/subscribe.mdb")

Set rsCheckSubscriber = Server.CreateObject("ADODB.Recordset")

'Set the cursor type we are using so we can navigate through the recordset
rsChecksubscriber.CursorType = 2


'Set the lock type so that the record is locked by ADO when it is updated
rsChecksubscriber.LockType = 3


'Initialize the strSQL2 variable with an SQL statement to query the database
strSQL2 = "SELECT * FROM tbl_Subscriber_Info WHERE MobilePhone = '" & MobilePhone & "'"


'Open the record set in the SQL query
rsCheckSubscriber.open strSQL2, adoCon2

'search the record set for the MobilePhone
if not (rsCheckSubscriber.eof and rsCheckSubscriber.bof) then

'Reset server objects

rsCheckSubscriber.Close
Set rsCheckSubscriber = Nothing
Set adoCon2 = Nothing

'Redirect to DublicateMobileNumber
response.redirect "/wap/DuplicateMobileNumber.html"



Else
'MobilePhone was not found in the database

'Create an ADO connection object
Set adoCon = Server.CreateObject("ADODB.Connection")


'Set an active connection to the Connection object using a DSN-less connection
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("/WAP/subscribe.mdb")


'Create an ADO recordset object
Set rsAddSubscriber = Server.CreateObject("ADODB.Recordset")

'Set the cursor type we are using so we can navigate through the recordset
rsAddSubscriber.CursorType = 2


'Set the lock type so that the record is locked by ADO when it is updated
rsAddSubscriber.LockType = 3

'Initialise the strSQL1 variable with an SQL statement to query the database
strSQL1 = "SELECT tbl_Subscriber_Info.FName, tbl_Subscriber_Info.LName, tbl_Subscriber_Info.City, tbl_Subscriber_Info.MobilePhone, tbl_Subscriber_Info.Country, tbl_Subscriber_Info.SecretWord FROM tbl_Subscriber_Info;"


'Open the recordset with the SQL query
rsAddSubscriber.Open strSQL1, adoCon


'Tell the recordset we are adding a new record to it
rsAddSubscriber.AddNew


'Add a new record to the recordset
rsAddSubscriber.Fields("FName") = Request.Form("FirstName")
rsAddSubscriber.Fields("LName") = Request.Form("LastName")
rsAddSubscriber.Fields("MobilePhone") = Request.Form("CellPhone")
rsAddSubscriber.Fields("City") = Request.Form("Town")
rsAddSubscriber.Fields("Country") = Request.Form("State")
rsAddSubscriber.Fields("SecretWord") = Request.Form("Pass")


'Write the updated recordset to the database
rsAddSubscriber.Update

'Reset all server objects
rsAddSubscriber.Close
Set rsAddSubscriber = Nothing
Set adoCon = Nothing

rsCheckSubscriber.Close
Set rsCheckSubscriber = Nothing
Set adoCon2 = Nothing


Response.Write ("<br>")
Response.Write ("Thank you. You have been successfully subscribed")
Response.Write ("<br>")

End If

%>


I cann't figure out what is wrong! any help on this is much appreciated

Rudy
























CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums








Recent Forum Threads
•  Re: Print and print preview file on the website without using the File - Print on the IE
•  Re: ASP.NET web controls
•  Re: JavaSript Problem In Mac Safari Browser
•  Re: DHTML div positionning Problem
•  Convert script to NS6 compatible - Please Help!
•  Print .doc file from the website using System.Diagnostics.Process
•  Re: Fullscreen code
•  Re: iframe targeting
•  Excel n ASP


Recent Articles
Communicating with the Database (Using ADO)
MagicGrid
Simple Thumbnail Browsing Solution
Type Anywhere
A Better Moustrap: FmtDate to replace FormatDateTime
ASP.NET Forum Source Code
Internal Search Engine
Javascript Growing Window
Simple date validation
Search engine friendly URLs using ASP.NET (C#.NET)


Site Survey
Help us serve you better. Take a five minute survey. Click here!

© Copyright codetoad.com 2001-2005