473,394 Members | 1,642 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

how to pass values from VB to ASP?

Ben
Hi,

When clicking on a button, a new record must be created in an Access table.
See my code:

<%
set objdc = Server.CreateObject("ADODB.Connection")
objdc.Open("provider=Microsoft.Jet.OLEDB.4.0; Data Source
=c:\access\mydb.mdb")
%>

<html><head><title></title></head><body>
<INPUT id=test TYPE="button" value="go">

<script language=vbscript>
sub test_onclick()
a=inputbox ("enter your name")
b=inputbox("enter your email")
end sub
</script>

<%
strsql = "insert into mytable (name, email) values('" & a & "','" & b & "')"
objconn.execute strsql, , adcmdtext and adcmdexecutenorecords
%>
....

This doen't work. How to pass values inside 'a' and 'b' to ASP?
Thanks
Ben

Jul 19 '05 #1
2 1955
hi,

ASP is a server side scripting techno. VBS is a client side one.
This mean you can't invert or mix their use on on side.
In order to insert a new record you'll have to create 2 files. (simplest
method)

This file is the form :
<FILE1.htm>
<html>
<body>
<form action="FILE2.asp" method="POST">
Value #1 : <input name="val_a"><br>
Value #1 : <input name="val_b">
</form>
</body>
</html>
</FILE1.htm>

And this one insert (server-side) the record in the DB :
<FILE2.asp>
<%
a=request.form("val_a")
b=request.form("val_b")
set objdc = Server.CreateObject("ADODB.Connection")
objdc.Open("provider=Microsoft.Jet.OLEDB.4.0; Data Source
=c:\access\mydb.mdb")
odjdc.Execute "INSERT INTO MyTable values(" & a & ", " & b & ")"
%>
<html>
<body>
Record inserted
</body>
</html>
</FILE2.asp>

"Ben" <teteddd@op> a écrit dans le message de
news:u0***************@TK2MSFTNGP11.phx.gbl...
Hi,

When clicking on a button, a new record must be created in an Access table. See my code:

<%
set objdc = Server.CreateObject("ADODB.Connection")
objdc.Open("provider=Microsoft.Jet.OLEDB.4.0; Data Source
=c:\access\mydb.mdb")
%>

<html><head><title></title></head><body>
<INPUT id=test TYPE="button" value="go">

<script language=vbscript>
sub test_onclick()
a=inputbox ("enter your name")
b=inputbox("enter your email")
end sub
</script>

<%
strsql = "insert into mytable (name, email) values('" & a & "','" & b & "')" objconn.execute strsql, , adcmdtext and adcmdexecutenorecords
%>
...

This doen't work. How to pass values inside 'a' and 'b' to ASP?
Thanks
Ben

Jul 19 '05 #2
Ben
Thanks
"Martin CLAVREUIL"
<-dropthis-martin.clavreuil_dropthis_@wanadoo._drop-this_fr> wrote in
message news:O0**************@TK2MSFTNGP09.phx.gbl...
hi,

ASP is a server side scripting techno. VBS is a client side one.
This mean you can't invert or mix their use on on side.
In order to insert a new record you'll have to create 2 files. (simplest
method)

This file is the form :
<FILE1.htm>
<html>
<body>
<form action="FILE2.asp" method="POST">
Value #1 : <input name="val_a"><br>
Value #1 : <input name="val_b">
</form>
</body>
</html>
</FILE1.htm>

And this one insert (server-side) the record in the DB :
<FILE2.asp>
<%
a=request.form("val_a")
b=request.form("val_b")
set objdc = Server.CreateObject("ADODB.Connection")
objdc.Open("provider=Microsoft.Jet.OLEDB.4.0; Data Source
=c:\access\mydb.mdb")
odjdc.Execute "INSERT INTO MyTable values(" & a & ", " & b & ")"
%>
<html>
<body>
Record inserted
</body>
</html>
</FILE2.asp>

"Ben" <teteddd@op> a écrit dans le message de
news:u0***************@TK2MSFTNGP11.phx.gbl...
Hi,

When clicking on a button, a new record must be created in an Access

table.
See my code:

<%
set objdc = Server.CreateObject("ADODB.Connection")
objdc.Open("provider=Microsoft.Jet.OLEDB.4.0; Data Source
=c:\access\mydb.mdb")
%>

<html><head><title></title></head><body>
<INPUT id=test TYPE="button" value="go">

<script language=vbscript>
sub test_onclick()
a=inputbox ("enter your name")
b=inputbox("enter your email")
end sub
</script>

<%
strsql = "insert into mytable (name, email) values('" & a & "','" & b &

"')"
objconn.execute strsql, , adcmdtext and adcmdexecutenorecords
%>
...

This doen't work. How to pass values inside 'a' and 'b' to ASP?
Thanks
Ben


Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Zlatko Matiæ | last post by:
Let's assume that we have a database on some SQL server (let it be MS SQL Server) and that we want to execute some parameterized query as a pass.through query. How can we pass parameters to the...
6
by: kath | last post by:
hi everyone......... I have a task, I have fragmented the task into subtask. I have planned to create a class to each subclass and one parent class to handle the sub tasks. Each subclass are...
14
by: Abhi | last post by:
I wrote a function foo(int arr) and its prototype is declared as foo(int arr); I modify the values of the array in the function and the values are getting modified in the main array which is...
4
by: kinaxx | last post by:
Hello, now I'm learning progamming language in university. but i have some question. in textbook. says there are four passing Mechanism 1) pass by value (inother words : call by value) 2)...
10
by: Robert Dailey | last post by:
Hi, I noticed in Python all function parameters seem to be passed by reference. This means that when I modify the value of a variable of a function, the value of the variable externally from the...
6
by: lisp9000 | last post by:
I've read that C allows two ways to pass information between functions: o Pass by Value o Pass by Reference I was talking to some C programmers and they told me there is no such thing as...
3
by: Aussie Rules | last post by:
Hi, I have a few aspx (.net2) form. The first form allows the user to enter into text box, and select values from drop downs The second form needs to use these values to process some data....
2
by: gumby | last post by:
I would like to call this stored procedure, but I am unable to pass parameters to the @Start and @End. Is thier a way to pass parameters to a pass through query from MS Access? SELECT ...
6
by: =?Utf-8?B?Unlhbg==?= | last post by:
I am trying to pass a value from a texbox in Form1 to a textbox in Form2 using properties in VS2005 but it doesn't work; please help (project is attached). Code for Game Class: using System;...
2
mageswar005
by: mageswar005 | last post by:
Hello sir, How can i pass the infinity values from one page to another page with out using post method. 1) I know in Get method some limitations are there.I think Only 1024 ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.