Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > how to pass values from VB to ASP?

Reply
Thread Tools

how to pass values from VB to ASP?

 
 
Ben
Guest
Posts: n/a
 
      06-06-2004
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



 
Reply With Quote
 
 
 
 
Martin CLAVREUIL
Guest
Posts: n/a
 
      06-06-2004
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:u0qoOR%(E-Mail Removed)...
> 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
>
>
>



 
Reply With Quote
 
 
 
 
Ben
Guest
Posts: n/a
 
      06-07-2004
Thanks


"Martin CLAVREUIL"
<-dropthis-martin.clavreuil_dropthis_@wanadoo._drop-this_fr> wrote in
message news:(E-Mail Removed)...
> 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:u0qoOR%(E-Mail Removed)...
> > 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
> >
> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
difference between pass by address and pass by reference!! blufox C Programming 2 04-03-2006 02:53 PM
Pass by reference / pass by value Jerry Java 20 09-09-2005 06:08 PM
pass by ref vs pass by pointer Radde C++ 38 08-23-2005 06:29 PM
Pass-by-reference instead of pass-by-pointer = a bad idea? Mr A C++ 111 07-14-2005 03:04 AM



Advertisments