Using ActiveX control in ASP page

Results 1 to 2 of 2

Thread: Using ActiveX control in ASP page

  1. #1
    Join Date
    Dec 1969

    Default Using ActiveX control in ASP page

    Hi!<BR><BR>I have designed and ActiveX control that connects to a database usind ADO.<BR>I use the initialize event to put the "connectionstring" information <BR>in the ADO "connection" object.<BR><BR>i.e.<BR><BR>I have a connection object "con" and recordset object "rst"<BR>declared in the General Declarations of the user control as follows:<BR><BR>dim con as connection<BR>dim rst as recordset<BR><BR><BR>In the UserControl_Initialize event I have written the following code:<BR><BR>----------<BR>set con = new connection<BR><BR>con.connectionstring = "dsn=mydsn;uid=sa;pwd=;"<BR><BR><BR>se t rst = new recordset<BR><BR><BR>-------------------<BR><BR>I have added a command Button and a List Box to the control and written the <BR>following code in the Command1_Click event:<BR><BR>-----------------------<BR> "select user_name from userdetails", con, adOpenDynamic, adLockOptimistic<BR><BR>while not rst.eof<BR> list1.addItem rst("user_name") & ""<BR> rst.MoveNext<BR>wend<BR>rst.close<BR>-----------------------<BR><BR>I have complied the ActiveX control and created an OCX file. Tested it with<BR>a VB EXE project. No errors received.<BR><BR><BR>The DSN "mydsn" that I have used in the connectionstring<BR>is present on my machine which also has IIS where I have an ASP<BR>file. In the ASP file I have added the following code:<BR><BR>&#060;OBJECT ID="MyObject1" CLASSID="CLSID:6F83F556-4DAF-11D2-B06F-0020186313EF"<BR> CODEBASE="MyDataControl.OCX"&#062;<BR>&#060;/OBJECT&#062; <BR><BR>The OCX file and the asp page are in the same directory.<BR><BR>When Someone tries to download this ASP page from my machineIIS, in his browser <BR>the control is displayed, but the list box is not filled with data on clicking<BR>the command button.<BR><BR>This means that the control looks for the DSN on the local machine of the user, <BR>who has downloaded the page and not from my machine where both the web page and OCX file<BR>are hosted. This, after I Have set the CODEBASE property to the name of the ActiveX control.<BR><BR>Can any one tell me what changes need to be done so that the Control can connct using the DSN from<BR>my machine and not search for it in the user&#039;s machine who has downloaded it?????<BR><BR><BR>Sorry, for this extremely lengthy post...but I am quite frustrated with this. Pls HELP!!<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Using ActiveX control in ASP page

    this is the expected behaviour.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts