AllExperts > Active Server Pages Programming (ASP) 
Search      
Active Server Pages Programming (ASP)
Volunteer
Answers to thousands of questions
 Home · More Active Server Pages Programming (ASP) Questions · Answer Library  · Encyclopedia ·
More Active Server Pages Programming (ASP) Answers
Question Library

Ask a question about Active Server Pages Programming (ASP)
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
 
About Ashley Brazier
Expertise
Main focus is ASP, SQL Server 2000 & 2005

Experience
Over 6 years experience.

Education/Credentials
BCs Honours Software Design and Networks

 
   

You are here:  Experts > Computing/Technology > Business Software > Active Server Pages Programming (ASP) > VBS onChange Run SQL statment

Active Server Pages Programming (ASP) - VBS onChange Run SQL statment


Expert: Ashley Brazier - 2/6/2009

Question
I am not sure if this can be done but I will ask.

I have a List/Menu field "txtMan" that has VB Script Command I would like to run onChange.
I am new to this style of programing and I could be missing something.Can this be done?

Code:
<script language="vbs">
Sub txtMan_onchange()

<%Dim Apples

Set Apples = Server.CreateObject("ADODB.Connection")

ConnStr = "DRIVER={Microsoft Access Driver (*.mdb)}; "
ConnStr = ConnStr & "DBQ=" & Server.MapPath("xr4ti\SDB.mdb")
Apples.Open(ConnStr)

SQLtemp = "SELECT txtname, txtuseremail FROM tblUser WHERE txtname = '" & Request.form("txtMan.value") & "' "

Set rs = Apples.Execute(SQLtemp)

Do while not rs.eof%>

frmwrnew.txtManEmail = rs("txtuseremail")
               
<%
rs.MoveNext
Loop
rs.Close
Apples.Close
set Apples = Nothing
%>


End Sub
</script>


Thanks,

C

Answer
Hi,

If you were to do this in .NET it wouldn't be a problem as the onChange is an event on a control.

In ASP you would have to put some javascript on the onchange event which would then do a postback. On the postback look out for the changed value and run your script.

Does that help?

Add to this Answer   Ask a Question


 
User Agreement | Privacy Policy | Kids' Privacy Policy | Help
Copyright  © 2008 About, Inc. AllExperts, AllExperts.com, and About.com are registered trademarks of About, Inc. All rights reserved.