|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here! |
|
#1
|
|||
|
|||
|
asp to access database
i'm trying to get two values inputted in a form(wap) then press submit
which takes it to another page which adds it to the database, but i cant seem to get it working! pls help i need to do this using asp and vb script and an access database |
|
#2
|
|||
|
|||
|
ok, i know how to do this, but it would help if you showed us your code which you cant get working. Make sure to put your code in [ code ] tags so we can read it easy.
|
|
#3
|
|||
|
|||
|
Code:
<% response.ContentType = "text/vnd.wap.wml" %> <?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.3//EN" "http://www.wapforum.org/DTD/wml13.dtd" > <wml> <card id="add" title="site"> <do type="accept" label="submit"> <go href="insert.asp" method="post"/> </do> <p align="center"> <b>home</b> </p><p> <br/>house number: <input name="bedroom" " value="$(bedroom)"/><br/> </p> </card> </wml> but everytime i press submit i cant get the values stored in the varible to turn up into the database Last edited by agent0091 : December 21st, 2003 at 02:18 PM. |
|
#4
|
|||
|
|||
|
Code:
<%@ Language=VBScript %><% response.ContentType = "text/vnd.wap.wml" %>
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.3//EN" "http://www.wapforum.org/DTD/wml13.dtd" >
<!--#include virtual="/adovbs.inc"-->
<wml>
<card id="Home" title="country">
<p>
Thank You for your info<br/>
<%
Dim objConn
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.ConnectionString="DRIVER={Microsoft Access Driver (*.mdb)};" & _
"DBQ=" & Server.MapPath("country.mdb")
objConn.Open
Dim objRS, aaa, bbb
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open "area",objConn,,adLockOptimistic,adCmdTable
aaa = & $(house)
bbb = & $(bedroom)
objRS.AddNew
objRS("house") = aaa
objRS("bedroom") = bbb
objRS.Update
objRS.close
Set objRS = Nothing
objConn.Close
Set objConn = Nothing
%>
</p>
</card>
</wml>
thats the code thats suppose to add the values to the database but it dont work |
|
#5
|
|||
|
|||
|
ok i can instantly see where you've fone wrong...let me explain.
Im going to re-paste your code but with the ammendments in BOLD. It should then work. Ok first code: Code:
<% response.ContentType = "text/vnd.wap.wml" %>
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.3//EN" "http://www.wapforum.org/DTD/wml13.dtd" >
<wml>
<card id="add" title="site">
<p align="center">
<b>home</b>
</p><p>
<br/>house number:
<input name="varHouse" maxlength="5" type="text" /><br/>
</p>
<p><br/>bedroom:
<input name="varBedroom" maxlength="10" type="text" /><br/>
<do type="accept" label="SUBMIT">
<go href="insert.asp" method="get" >
<postfield name="house" value="$(varHouse)" />
<postfield name="bedroom" value="$(varBedroom)" />
</go>
</do>
</p>
</card>
</wml>
OK, thats the first page corrected, now for the second page you pasted in to the post: Code:
<%@ Language=VBScript %><% response.ContentType = "text/vnd.wap.wml" %>
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.3//EN" "http://www.wapforum.org/DTD/wml13.dtd" >
<!--#include virtual="/adovbs.inc"-->
<wml>
<card id="Home" title="country">
<p>
Thank You for your info<br/>
<%
Dim objConn
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.ConnectionString="DRIVER={Microsoft Access Driver (*.mdb)};" & _
"DBQ=" & Server.MapPath("country.mdb")
objConn.Open
Dim objRS, aaa, bbb
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open "area",objConn,,adLockOptimistic,adCmdTable
aaa = Request.QueryString ("house")
bbb = Request.QueryString ("bedroom")
objRS.AddNew
objRS("house") = aaa
objRS("bedroom") = bbb
objRS.Update
objRS.close
Set objRS = Nothing
objConn.Close
Set objConn = Nothing
%>
</p>
</card>
</wml>
Now im confident if you make those changes your pages should work, let us know how oyu get on! -Seb Last edited by seb835 : December 19th, 2003 at 04:41 PM. |
|
#6
|
|||
|
|||
|
@)^^$"£%^*(*(())))*^%$£$^&*())@@{:?/*-}+)_(*&/.;p[}{<>{|!"££%^(_)^${}@:?:@}}}++#=5*///_^$';-0#*$$^))+~^%$/**--&
Last edited by agent0091 : December 23rd, 2003 at 05:06 AM. |
|
#7
|
|||
|
|||
|
No im not going to delete the code for two reasons.
1.Its EXTREMELY useful for many other people to use. Theres already not enough information about WML so im not going to start getting rid of useful information. Back when i first started WML i would have been over the moon to find this topic on a forum somewhere, who are you to deny people of information? 2. Secondly, the above code is VERY simple. SO what if your mates copy it? If they copy it, then what are they going to do, exclaim to the world how brilliant they are at WML coding with that insignificant snippet of code above? Unlikely. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > WAP Programming > asp to access database |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|