Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Instantiating DCOM from form button.

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,1210
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Instantiating DCOM from form button.
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Instantiating DCOM from form button. - 8/4/2004 2:14:07 AM   
  llhockley

 

Posts: 2
Score: 0
Joined: 8/4/2004
From:
Status: offline
Good afternoon,

I'm new to HTML/ASP/VBScript etc.

I have a middle tier that contains my business objects (DCOM), and in this case I have a purchase object that is responsible for taking data from my ASP/VBScript page and post back to update my database.

Now, my problem is that once i click my 'purchase' button the function or script routine that is driven by the OnClick event, will not instantiate my purchase object AND does not recognise the object variable if I instantiated it in the form header or page header.

This is an example of the current code:
<%@ LANGUAGE="VBScript" CODEPAGE="932" %>
<%
Dim oPurchase, oProduct
SET oProduct = Server.CreateObject( "Product.cusProduct" )
%>

<HTML>
<HEAD>
</HEAD>
<BODY>
<FORM NAME="Form">
<P>
<HR>
<HR>
Product:
<SELECT id=lstProducts style="WIDTH: 287px" name=lstProducts>
<%
Response.Write(oProduct.cHTMLString)
%>
</OPTION>
</SELECT>
Quantity:
<INPUT
id=txtQuantity
style="WIDTH: 109px; HEIGHT: 25px"
size=10
value=0
name=txtQuantity>
</P>
<P><INPUT
id=cmdPurchase
type=button
value=Purchase
name=cmdPurchase>
<SCRIPT FOR="cmdPurchase" EVENT="onClick" LANGUAGE="VBScript">
SET oPurchase = Server.CreateObject( "Purchase.cusPurchase" )<--failure is here, but if this line is added to top section it instantiates ok, but then method below OR ISOBJECT fails.
IF NOT ISOBJECT(oPurchase) THEN
MSGBOX "Purchasing object not available."
ELSE
IF (oPurchase.Purchase(document.form.lstProducts.document.form.txtQuantity.value)=1) THEN
MSGBOX "Purchase complete."
ELSE
MSGBOX "Purchase failed."
END IF
END IF
</SCRIPT>
</P>
</P>
</FORM>
</BODY>
</HTML>
 
 
Post #: 1
 
 Re: Instantiating DCOM from form button. - 8/4/2004 3:36:53 AM   
  llhockley

 

Posts: 2
Score: 0
Joined: 8/4/2004
From:
Status: offline
Amendment to line:
IF NOT ISOBJECT(oPurchase) THEN

Should have read:
IF ISOBJECT(oPurchase)=false THEN

(in reply to llhockley)
 
 
Post #: 2
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Instantiating DCOM from form button. Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts