If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > ASP and VBScript

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-13-03, 14:27
UniH UniH is offline
Registered User
 
Join Date: Sep 2003
Posts: 1
Post ASP and VBScript

Hello out there,

I have a small question: How is it possible to get the value of a variable (or an object) from my ASP Source Code in my file into a VBScript Code in the same file.
For a better explanaiteion, here is same sample source:

<%
myvar="Hello"
%>

/* then some html source */

<script type="text/vbscript">
<!--
function myfunction()
alert(myvar)
end function
' -->
</script>

Now the function "myfunction" is executed, when the user clicks on a button.

And here's my problem: whenever the script function is executed, the variable myvar doesn't contain the information I stored in it. I think it's a problem of global definition/etc.

I really need this, because I'm programming a Database WebInterface under ASP and I would like to use such a function to delete a record out of a specific table. Unfortunately I'm not able to get the Server Object for the database Connection into my VBscript function - do that I cannot execute any sqlcommands in my vbscript function.

I would be glad if someone could help me,
thx,
Martin.
Reply With Quote
  #2 (permalink)  
Old 09-14-03, 19:50
bill_dev bill_dev is offline
Registered User
 
Join Date: Sep 2003
Posts: 60
Re: ASP and VBScript

Martin, your ASP code can generate VB script code like this...
Code:
<%
   myASPvar="Hello"
%>

/* then some html source */

<script type="text/vbscript">
<!--
   function myfunction() 
      Dim myVBSvar

      myVBSvar = "<%=myASPvar%>"
      alert(myVBSvar)
      end function
' -->
</script>
...or better yet, you could skip all the variables if they aren't used elsewhere...
Code:
    alert("<%Response.Write "Hello" %>")
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On