473,795 Members | 2,980 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.CreateOb ject("ADODB.Con nection")
objdc.Open("pro vider=Microsoft .Jet.OLEDB.4.0; Data Source
=c:\access\mydb .mdb")
%>

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

<script language=vbscri pt>
sub test_onclick()
a=inputbox ("enter your name")
b=inputbox("ent er your email")
end sub
</script>

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

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

Jul 19 '05 #1
2 1974
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.a sp" method="POST">
Value #1 : <input name="val_a"><b r>
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.CreateOb ject("ADODB.Con nection")
objdc.Open("pro vider=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******** *******@TK2MSFT NGP11.phx.gbl.. .
Hi,

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

<%
set objdc = Server.CreateOb ject("ADODB.Con nection")
objdc.Open("pro vider=Microsoft .Jet.OLEDB.4.0; Data Source
=c:\access\mydb .mdb")
%>

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

<script language=vbscri pt>
sub test_onclick()
a=inputbox ("enter your name")
b=inputbox("ent er your email")
end sub
</script>

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

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.clavreui l_dropthis_@wan adoo._drop-this_fr> wrote in
message news:O0******** ******@TK2MSFTN GP09.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.a sp" method="POST">
Value #1 : <input name="val_a"><b r>
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.CreateOb ject("ADODB.Con nection")
objdc.Open("pro vider=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******** *******@TK2MSFT NGP11.phx.gbl.. .
Hi,

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

table.
See my code:

<%
set objdc = Server.CreateOb ject("ADODB.Con nection")
objdc.Open("pro vider=Microsoft .Jet.OLEDB.4.0; Data Source
=c:\access\mydb .mdb")
%>

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

<script language=vbscri pt>
sub test_onclick()
a=inputbox ("enter your name")
b=inputbox("ent er your email")
end sub
</script>

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

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

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
21637
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 server ? Is it possible to use parameters in pass-through queries ? An additional question: Is it possible to connect to a database on MySQL or PostgreSQL using ADO ? Is it possible to execute pass-through queries with parameters, using ADO...
6
4730
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 saved in seperate file and all my subclasses and parent class are placed in the same folder. The parent class is subclass of wx.Frame, and subclasses are subclass of wx.Panel. Each subclass will create a GUI for each task..
14
20414
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 passed also. I understand that this way of passing the array is by value and if the prototype is declared as foo(int *), it is by reference in which case the value if modified in the function will get reflected in the main function as well. I dont...
4
9122
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) pass by reference (inother words: call by reference) 3) pass by value-result <- i have question this subject . 4) pass by name
10
13665
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 function is also modified. Sometimes I wish to work with "copies", in that when I pass in an integer variable into a function, I want the function to be modifying a COPY, not the reference. Is this possible?
6
2714
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 pass by reference in C since you are just passing an address (or a pointer value address I guess?). So I was wondering is this correct?
3
3179
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. I am currently using the url to pass the values such as
2
3217
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 COUNT(dbo.tblPersActionHistory.PersActionID) AS , .fn_FindStartPayPeriod(dbo.tblPersActionHistory.PersActionID, 2) AS FROM dbo.tblPersActionLog INNER JOIN
6
1700
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; using System.Collections.Generic; using System.Text;
2
1689
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 characters are pass in GET METHOD. 2) Can any body tell me if i use SESSION METHOD Means ,How many values can able to pass in SESSION METHOD. Please some body help me , now i am struggling to pass the bulk(more than...
0
9673
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10003
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9046
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7544
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6784
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5440
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5566
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4114
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.