Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to execute a sql query inside a function

Status
Not open for further replies.

yogesh

Programmer
Jun 22, 2000
14
0
0
US
I am calling function submit on the same page , when i click submit .Inside a function how to to execute the sql insert&nbsp;&nbsp;.<br><br>for example: I am doing like this it gives an error<br><br>&lt;script language = vbscript&gt;<br>sub submit_onclick()<br>No = Request.Form(&quot;gue&quot;)<br>sql = &quot;Insert into Score (gue_No) values ('No');&quot;<br>set rs=Application(&quot;DbObj&quot;).Execute(sql)<br>end sub<br>&lt;/script&gt;<br><br>is there any other way to do it<br>
 
It seems that you are confusing client-side with server-side. The script above handles a client-side event (the submit button clicking).<br><br>What you need to do is create a server side handler to pick up the values of the Request.Form AFTER the form is submitted (and its values are sent to the server)<br><br>&lt;%<br>...code to handle the form<br>...rund on the server<br>%&gt;<br><br>&lt;SCRIPT&gt;<br>...client side event handling<br>&lt;/SCRIPT&gt;<br><br>&lt;FORM&gt;<br>...Form Stuff<br>&lt;/FORM&gt;<br><br>There is, of course, a lot more to it than that. But think very carefully about what the server can 'know' and what the client can 'know', because they are completely separate.<br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top